-
Notifications
You must be signed in to change notification settings - Fork 59
195 lines (180 loc) · 5.69 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
188
189
190
191
192
193
194
195
name: build
on:
push:
branches: [master]
paths-ignore:
- '**.md'
pull_request:
types: [opened, reopened, synchronize]
release:
types: [published]
jobs:
bot-build:
runs-on: ubuntu-latest
container:
image: ghcr.io/yapb/builder:latest
options: --hostname github-actions
strategy:
matrix:
arch: ['linux-x86', 'linux-amd64', 'linux-x86-gcc', 'linux-aarch64', 'darwin-x86', 'windows-x86-clang', 'windows-amd64', 'windows-x86-gcc']
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Configure meson
shell: bash
run: |
if [[ ${{matrix.arch}} == linux-x86 ]]; then
CXX=clang CXX_LD=lld meson setup ${{matrix.arch}}
elif [[ ${{matrix.arch}} == linux-x86-gcc ]]; then
CXX=gcc CXX_LD=gold meson setup ${{matrix.arch}}
elif [[ ${{matrix.arch}} == linux-amd64 ]]; then
CXX=clang CXX_LD=lld meson setup ${{matrix.arch}} -D64bit=true
elif [[ ${{matrix.arch}} == windows-amd64 ]]; then
meson setup ${{matrix.arch}} --cross-file ${{matrix.arch}} -D64bit=true
elif [[ ${{matrix.arch}} == darwin-x86 ]]; then
meson setup ${{matrix.arch}} --cross-file ${{matrix.arch}} -Db_lto=false
else
meson setup ${{matrix.arch}} --cross-file ${{matrix.arch}}
fi
- name: Build sources
shell: bash
run: |
meson compile -C ${{matrix.arch}}
echo "artifcat=${{matrix.arch}}/`ls ${{matrix.arch}}/ | egrep '^yapb.(so|dylib|dll)$' | head -1`" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.arch}}
path: ${{env.artifcat}}
bot-msvc:
env:
name: windows-x86-msvc
strategy:
matrix:
arch: ['windows-x86', 'windows-x86-msvc-xp']
fail-fast: false
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Setup msbuild
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_x86
- name: Install meson
run: |
python -m pip install --upgrade meson ninja
- name: Configure meson
shell: pwsh
run: |
if ('${{matrix.arch}}' -eq 'windows-x86-msvc-xp') {
meson setup ${{matrix.arch}} -Dwinxp=true
}
else {
meson setup ${{matrix.arch}}
}
- name: Build sources
run: |
meson compile -C ${{matrix.arch}}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.arch}}
path: |
${{matrix.arch}}/yapb.dll
${{matrix.arch}}/yapb.pdb
bot-continuous-release:
if: github.event_name == 'push'
name: bot-continuous-release
runs-on: ubuntu-latest
needs: [bot-build, bot-msvc]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Install signing tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends osslsigncode
- name: Get artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Configure meson
run: |
python -m pip install --upgrade meson ninja requests
- name: Create packages
run: |
meson setup dist
ninja -C dist package
env:
CS_CERTIFICATE: ${{secrets.CS_CERTIFICATE}}
CS_CERTIFICATE_PASSWORD: ${{secrets.CS_CERTIFICATE_PASSWORD}}
- name: Purge old build
continue-on-error: true
run: gh release delete continuous --cleanup-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Very important stage
continue-on-error: true
run: |
sleep 20s
- name: Push new build
run: gh release create continuous --generate-notes --prerelease --title "Continuous Build" ./pkg/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bot-release:
if: |
github.event_name == 'release' &&
github.event.action == 'published'
name: bot-release
runs-on: ubuntu-latest
needs: [bot-build, bot-msvc]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Install signing tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends osslsigncode
- name: Get artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Configure meson
run: |
python -m pip install --upgrade meson ninja requests
- name: Create packages
run: |
meson setup dist
ninja -C dist package
env:
CS_CERTIFICATE: ${{secrets.CS_CERTIFICATE}}
CS_CERTIFICATE_PASSWORD: ${{secrets.CS_CERTIFICATE_PASSWORD}}
- name: Publish release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: pkg/*
env:
GITHUB_TOKEN: ${{secrets.API_TOKEN}}