-
Notifications
You must be signed in to change notification settings - Fork 0
193 lines (191 loc) · 8.1 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
name: NES Dependencies builder
on:
push:
tags:
- 'v*'
jobs:
build-linux:
timeout-minutes: 360
name: ${{ matrix.osversion }} ${{ matrix.arch }}
runs-on: [self-hosted, linux, '${{ matrix.arch }}', dep-builder]
strategy:
fail-fast: false
matrix:
include:
- osversion: ubuntu-24.04
arch: "x64"
force_system_binary: 0
- osversion: ubuntu-20.04
arch: "x64"
force_system_binary: 0
- osversion: ubuntu-22.04
arch: "x64"
force_system_binary: 0
- osversion: ubuntu-24.04
arch: "arm64"
force_system_binary: 1
- osversion: ubuntu-20.04
arch: "arm64"
force_system_binary: 1
- osversion: ubuntu-22.04
arch: "arm64"
force_system_binary: 1
- osversion: rocky-8.7
arch: "arm64"
force_system_binary: 1
env:
VCPKG_DEP_LIST: ${{ matrix.arch }}-linux
VCPKG_FORCE_SYSTEM_BINARIES: ${{ matrix.force_system_binary }}
VCPKG_FEATURE_FLAGS: -binarycaching
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Checkout vcpkg submodules
working-directory: ${{ github.workspace }}/vcpkg/
run: git fetch --unshallow || true
- name: Set output vars to the actual tag name
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Build Docker
id: builddocker
working-directory: ${{ github.workspace }}/docker/
run: |
docker build \
-t nes_dep_build_${{ matrix.osversion }} \
-f Dockerfile-${{ matrix.osversion }} \
.
- name: Install vcpkg
id: bootstrapvcpkg
run: |
docker run \
-u $(id -u ${USER}):$(id -g ${USER}) \
-e ARCH=${{ matrix.arch }} \
-v ${{ github.workspace }}:/build_dir \
--rm \
nes_dep_build_${{ matrix.osversion }} /build_dir/vcpkg/bootstrap-vcpkg.sh -disableMetrics
shell: bash
- name: Install dependencies in manifest mode
id: installdeps
run: |
docker run \
-u $(id -u ${USER}):$(id -g ${USER}) \
-e ARCH=${{ matrix.arch }} \
-v ${{ github.workspace }}:/build_dir \
--rm \
nes_dep_build_${{ matrix.osversion }} /build_dir/vcpkg/vcpkg install \
--triplet=${{ env.VCPKG_DEP_LIST }}-nes \
--host-triplet=${{ env.VCPKG_DEP_LIST }}-nes \
--overlay-triplets=/build_dir/custom-triplets/ \
--x-manifest-root=/build_dir/ \
--overlay-ports=/build_dir/vcpkg-registry/ports
- name: Compress artifacts
id: compressdeps
run: |
mkdir nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes && \
mv \
${{ github.workspace }}/vcpkg_installed \
nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes/installed && \
mkdir -p nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes/scripts/buildsystems && \
cp \
${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
${{ github.workspace }}/nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes/scripts/buildsystems/ && \
touch ${{ github.workspace }}/nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes/.vcpkg-root && \
7z a -mx9 -aoa \
nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-${{ matrix.osversion }}-nes.7z \
nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes
- name: Release
uses: softprops/action-gh-release@v1
id: createrelease
with:
files: |
nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-${{ matrix.osversion }}-nes.7z
- name: Upload GitHub Actions artifact of vcpkg build logs
uses: actions/upload-artifact@v2
if: failure()
id: uploadlogs
with:
name: vcpkg-logs-${{ env.VCPKG_DEP_LIST }}
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log
- name: Clean build artifacts
id: cleanbuildartifacts
if: always()
run: |
rm -rf nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes \
nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-${{ matrix.osversion }}-nes.7z \
${{ github.workspace }}/vcpkg/{buildtrees,downloads,packages}
- name: Remove docker image
id: removedockerimage
if: always()
run: |
test -n "$(docker image ls -q nes_dep_build_${{ matrix.osversion }})" && \
docker image rm $(docker image ls -q nes_dep_build_${{ matrix.osversion }}) || \
true
build-osx:
timeout-minutes: 360
name: osx ${{ matrix.arch }}
runs-on: [self-hosted, macOS, '${{ matrix.arch }}']
strategy:
fail-fast: false
matrix:
include:
- arch: "x64"
- arch: "arm64"
env:
VCPKG_DEP_LIST: ${{ matrix.arch }}-osx
VCPKG_FEATURE_FLAGS: -binarycaching
steps:
- uses: lukka/get-cmake@latest
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Checkout vcokg submodules
working-directory: ${{ github.workspace }}/vcpkg/
run: git fetch --unshallow || true
- uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: x64
- name: Set output vars to the actual tag name
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Install vcpkg
id: bootstrapvcpkg
run: |
${{ github.workspace }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
shell: bash
- name: Install dependencies in manifest mode
id: installdeps
run: |
${{ github.workspace }}/vcpkg/vcpkg install --triplet=${{ env.VCPKG_DEP_LIST }}-nes --host-triplet=${{ env.VCPKG_DEP_LIST }}-nes --overlay-triplets=custom-triplets/ --overlay-ports=vcpkg-registry/ports
- name: Compress artifacts
id: compressdeps
run: |
mkdir nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes && \
mv ${{ github.workspace }}/vcpkg_installed nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes/installed && \
mkdir -p nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes/scripts/buildsystems && \
cp ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake ${{ github.workspace }}/nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes/scripts/buildsystems/ && \
touch ${{ github.workspace }}/nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes/.vcpkg-root && \
7z a nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes.7z nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes -mx9 -aoa
- name: Release
uses: softprops/action-gh-release@v1
id: createrelease
with:
files: |
nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes.7z
- name: Upload GitHub Actions artifact of vcpkg build logs
uses: actions/upload-artifact@v2
if: failure()
id: uploadlogs
with:
name: vcpkg-logs-${{ env.VCPKG_DEP_LIST }}
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log
- name: Clean build artifacts
id: cleanbuildartifacts
if: always()
run: |
rm -rf nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-nes \
nes-dependencies-${{ steps.vars.outputs.tag }}-${{ env.VCPKG_DEP_LIST }}-${{ matrix.osversion }}-nes.7z \
${{ github.workspace }}/vcpkg/{buildtrees,downloads,packages}