-
Notifications
You must be signed in to change notification settings - Fork 37
178 lines (155 loc) · 5.12 KB
/
Copy pathbuild.yaml
File metadata and controls
178 lines (155 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Build and Deploy libm2k
permissions:
contents: read
env:
APP_NAME: libm2k
on:
workflow_dispatch:
push:
branches:
- main
- '20[1-9][0-9]_R[1-9]'
- staging/*
tags:
- 'v*'
pull_request:
branches:
- main
- '20[1-9][0-9]_R[1-9]'
jobs:
identify_version:
runs-on: ubuntu-latest
outputs:
app-version: ${{ steps.set_version.outputs.version }}
steps:
- name: Checkout code repository
uses: actions/checkout@v4
- name: Set app version
id: set_version
run: |
# Extract version from CMakeLists.txt LIBM2K_VERSION_MAJOR/MINOR/PATCH variables
major=$(grep -oP 'set\s*\(\s*LIBM2K_VERSION_MAJOR\s+\K[0-9]+' CMakeLists.txt)
minor=$(grep -oP 'set\s*\(\s*LIBM2K_VERSION_MINOR\s+\K[0-9]+' CMakeLists.txt)
patch=$(grep -oP 'set\s*\(\s*LIBM2K_VERSION_PATCH\s+\K[0-9]+' CMakeLists.txt)
if [[ -n "$major" && -n "$minor" && -n "$patch" ]]; then
cmake_version="$major.$minor.$patch"
else
echo "Failed to extract version from CMakeLists.txt, using default"
cmake_version="0.0.1+${{ github.sha }}"
fi
echo "Version to use: $cmake_version"
echo "version=$cmake_version" >> "$GITHUB_OUTPUT"
build_arm64_native:
runs-on: ubuntu-24.04-arm
needs: identify_version
env:
architecture: arm64
strategy:
fail-fast: false
matrix:
include:
- docker_image: arm64v8/debian:trixie
distro: debian13
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
path: ${{env.APP_NAME}}
- name: Start persistent container
run: |
docker run -d \
--name ${{matrix.distro}}-${{env.architecture}} \
-v "$GITHUB_WORKSPACE/${{env.APP_NAME}}:/workspace/${{env.APP_NAME}}" \
-w /workspace/${{env.APP_NAME}} \
${{matrix.docker_image}} tail -f /dev/null
- name: Create debian package
run: |
docker exec ${{matrix.distro}}-${{env.architecture}} sh -c ".github/scripts/create_debian.sh ${{needs.identify_version.outputs.app-version}}"
- name: Copy debian artifacts from container to host
run: |
docker cp ${{matrix.distro}}-${{env.architecture}}:/workspace/. ./artifacts/
ls -la ./artifacts/
- name: Upload debian artifacts to github
uses: actions/upload-artifact@v4
with:
name: ${{env.APP_NAME}}-${{matrix.distro}}-${{env.architecture}}
path: |
artifacts/*.deb
artifacts/*.dsc
artifacts/*.debian.tar.xz
artifacts/*.orig.tar.gz
if-no-files-found: error
build_armhf_qemu:
runs-on: ubuntu-latest
needs: identify_version
env:
architecture: armhf
strategy:
fail-fast: false
matrix:
include:
- docker_image: arm32v7/debian:trixie
distro: debian13
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
path: ${{env.APP_NAME}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Start persistent container
run: |
docker run -d \
--platform linux/arm/v7 \
--name ${{matrix.distro}}-${{env.architecture}} \
-v "$GITHUB_WORKSPACE/${{env.APP_NAME}}:/workspace/${{env.APP_NAME}}" \
-w /workspace/${{env.APP_NAME}} \
${{matrix.docker_image}} tail -f /dev/null
- name: Create debian package
run: |
docker exec ${{matrix.distro}}-${{env.architecture}} sh -c ".github/scripts/create_debian.sh ${{needs.identify_version.outputs.app-version}}"
- name: Copy debian artifacts from container to host
run: |
docker cp ${{matrix.distro}}-${{env.architecture}}:/workspace/. ./artifacts/
ls -la ./artifacts/
- name: Upload debian artifacts to github
uses: actions/upload-artifact@v4
with:
name: ${{env.APP_NAME}}-${{matrix.distro}}-${{env.architecture}}
path: |
artifacts/*.deb
artifacts/*.dsc
artifacts/*.debian.tar.xz
artifacts/*.orig.tar.gz
if-no-files-found: error
build_ubuntu:
runs-on: ubuntu-latest
needs: identify_version
env:
architecture: amd64
defaults:
run:
working-directory: ${{env.APP_NAME}}
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
path: ${{env.APP_NAME}}
- name: Create .deb package
run: |
.github/scripts/create_debian.sh ${{needs.identify_version.outputs.app-version}}
- name: Copy debian artifacts
run: |
mkdir -p artifacts
cp ../*.deb ../*.dsc ../*.debian.tar.xz ../*.orig.tar.gz artifacts/
ls -la artifacts/
- name: Upload debian artifacts to github
uses: actions/upload-artifact@v4
with:
name: ${{env.APP_NAME}}-ubuntu
path: |
${{env.APP_NAME}}/artifacts/*.deb
${{env.APP_NAME}}/artifacts/*.dsc
${{env.APP_NAME}}/artifacts/*.debian.tar.xz
${{env.APP_NAME}}/artifacts/*.orig.tar.gz
if-no-files-found: error