forked from GrandOrgue/grandorgue
-
Notifications
You must be signed in to change notification settings - Fork 0
187 lines (159 loc) · 5.81 KB
/
build.yml
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
179
180
181
182
183
184
185
186
187
name: Build
on: [push]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install Test Dependencies
run: ${{github.workspace}}/build-scripts/for-linux/prepare-debian-for-tests.sh
- name: Build
working-directory: ${{github.workspace}}
run: ${{github.workspace}}/build-scripts/for-linux/build-for-tests.sh amd64
- name: Run tests
working-directory: ${{github.workspace}}
run: ${{github.workspace}}/build-scripts/for-linux/do-tests.sh
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
calc_ver:
# calculate versions from git tags
runs-on: ubuntu-latest
outputs:
project_ver: ${{steps.vers.outputs.project_ver}}
build_ver: ${{steps.vers.outputs.build_ver}}
full_ver: ${{steps.vers.outputs.full_ver}}
release_flag: ${{steps.vers.outputs.release_flag}}
release_id: ${{ steps.create_release.outputs.id }}
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set git tags and compose RELNOTES.md
shell: bash
run: ${{github.workspace}}/build-scripts/for-github/autotag.sh
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') }}
- name: Calculate relnotes file
id: relnotes
shell: bash
run: |
[[ -e RELNOTES.md ]] && RELNOTES_FILE=RELNOTES.md
echo "file=$RELNOTES_FILE" >>$GITHUB_OUTPUT
- name: Calculate versions
id: vers
shell: bash
run: |
git fetch --prune --unshallow --tags || true
GIT_VERSION=`git describe --tags`
PROJECT_VERSION=`echo $GIT_VERSION | cut -d- -f1`
BUILD_VERSION=`echo $GIT_VERSION | cut -d- -f2-3 --output-delimiter=.`
GIT_CHANGE_NUM=`echo $GIT_VERSION | cut -d- -f3`
if [[ -n "$GIT_CHANGE_NUM" ]] || [[ "$BUILD_VERSION" < "1" ]]; then
RELEASE_FLAG=OFF
else
RELEASE_FLAG=ON
fi
echo "project_ver=$PROJECT_VERSION" >>$GITHUB_OUTPUT
echo "build_ver=$BUILD_VERSION" >>$GITHUB_OUTPUT
echo "full_ver=$PROJECT_VERSION-$BUILD_VERSION" >>$GITHUB_OUTPUT
echo "release_flag=$RELEASE_FLAG" >>$GITHUB_OUTPUT
- name: Display versions
run: |
echo "project_ver=${{steps.vers.outputs.project_ver}}"
echo "build_ver=${{steps.vers.outputs.build_ver}}"
echo "full_ver=${{steps.vers.outputs.full_ver}}"
echo "release_flag=${{steps.vers.outputs.release_flag}}"
- name: Create Draft Release
if: ${{ steps.vers.outputs.release_flag == 'ON' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ steps.vers.outputs.full_ver }}"
release_name: "v${{ steps.vers.outputs.full_ver }}"
draft: true
prerelease: false
body_path: "${{ steps.relnotes.outputs.file }}"
build:
needs: [calc_ver]
strategy:
fail-fast: false
matrix:
include:
- run_on: ubuntu-20.04
for: linux
prepare: "debian-based"
build_on: linux
- run_on: ubuntu-20.04
for: linux
prepare: "debian-based"
build_on: linux
pkg_suffix: wx32
- run_on: ubuntu-20.04
for: appimage-x86_64
prepare: "debian-based"
build_on: linux
- run_on: ubuntu-20.04
for: linux-armhf
prepare: "debian-based"
build_on: linux
- run_on: ubuntu-20.04
for: linux-armhf
prepare: "debian-based"
build_on: linux
pkg_suffix: wx32
- run_on: ubuntu-20.04
for: linux-aarch64
prepare: "debian-based"
build_on: linux
- run_on: ubuntu-20.04
for: linux-aarch64
prepare: "debian-based"
build_on: linux
pkg_suffix: wx32
- run_on: macos-13 # x86_64
for: osx
prepare: osx
build_on: osx
- run_on: macos-14 # arm64
for: osx
prepare: osx
build_on: osx
- run_on: ubuntu-latest
for: win64
prepare: "debian-based"
build_on: linux
runs-on: ${{ matrix.run_on }}
steps:
- uses: actions/[email protected]
with:
submodules: true
- name: Install Dependencies
run: ${{github.workspace}}/build-scripts/for-${{ matrix.for }}/prepare-${{ matrix.prepare }}.sh "${{ matrix.pkg_suffix }}"
- name: Build
working-directory: ${{github.workspace}}
run: ${{github.workspace}}/build-scripts/for-${{ matrix.for }}/build-on-${{ matrix.build_on }}.sh ${{needs.calc_ver.outputs.project_ver}} ${{needs.calc_ver.outputs.build_ver}} ${{github.workspace}} "${{ matrix.pkg_suffix }}"
- name: Upload result
uses: nanoufo/action-upload-artifacts-and-release-assets@v2
with:
path: |
${{github.workspace}}/build/${{ matrix.for }}/grandorgue*${{needs.calc_ver.outputs.full_ver}}*
upload-release-files: ${{ needs.calc_ver.outputs.release_flag }}
release-upload-url: ${{ needs.calc_ver.outputs.release_upload_url }}
if-no-files-found: error
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
needs: [calc_ver, build]
if: ${{ needs.calc_ver.outputs.release_flag == 'ON' }}
runs-on: ubuntu-latest
steps:
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.calc_ver.outputs.release_id }}