-
Notifications
You must be signed in to change notification settings - Fork 18
203 lines (174 loc) · 5.7 KB
/
c-cpp.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
196
197
198
199
200
201
202
203
name: Autobuild
on:
push:
branches-ignore: 'build-test*'
tags: '*'
pull_request:
branches: '*'
defaults:
run:
shell: bash
jobs:
Autobuild:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
arch: x86
env: Windows
- os: windows-latest
arch: x86
env: Windows
config: Debugrec
- os: windows-latest
arch: x64
env: Windows
- os: ubuntu-20.04
arch: x64
env: Linux
- os: ubuntu-20.04
arch: x64
env: Linux
config: Debugrec
- os: macos-12
arch: x64
env: Mac
runs-on: ${{ matrix.os }}
env:
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: "Setup Directories"
run: mkdir output
- name: "Configure Platform"
run: |
echo "CONFIG_SUFFIX=${{ matrix.env }}-${{ matrix.arch }}" >> $GITHUB_ENV
autobuild/${{ matrix.env }}.sh
- name: "Configure Platform Architecture"
run: |
autobuild/${{ matrix.env }}-${{ matrix.arch }}.sh
- name: "Linux: Setup"
if: ${{ matrix.env == 'Linux' }}
run: $CHROOT autobuild/setup_linux.sh
- name: "Mac: Work around libpng mess"
if: ${{ matrix.env == 'Mac' }}
run: sudo rm -r /Library/Frameworks/Mono.framework/Headers
- name: "Windows: Setup VS Dev Environment"
if: ${{ matrix.env == 'Windows' }}
uses: seanmiddleditch/gha-setup-vsdevenv@v4
with:
arch: ${{ env.VS_ARCH }}
- name: "Dependencies"
run: |
mkdir deps
cd deps
curl -L https://github.com/legacyclonk/deps/releases/download/2024-07-01/lc_deps-$CONFIG_SUFFIX.tar.gz | tar -xz
./fix_paths.sh
- name: Configure
run: |
$CHROOT cmake -B build . -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_TESTS=On -DCMAKE_CTEST_ARGUMENTS=--output-on-failure $CMAKE_CONFIGURE_ARGS
- name: "Enable Debugrec"
if: ${{ matrix.config == 'Debugrec' }}
run: |
cmake -B build -DDEBUGREC=On
echo "CONFIG_SUFFIX=${{ matrix.env }}-${{ matrix.arch }}-debugrec" >> $GITHUB_ENV
- name: "Disable PCH"
if: ${{ matrix.config == 'Debugrec' && matrix.env == 'Linux' }}
run: |
cmake -B build -DUSE_PCH=Off
- name: Build
run: |
$CHROOT cmake --build build $CMAKE_BUILD_ARGS
- name: Test
run: |
$CHROOT cmake --build build --target test
- name: "Build c4gs"
if: ${{ matrix.env == 'Linux' }}
run: |
C4GROUP=$PWD/build/c4group tools/make_Graphics.c4g.sh
C4GROUP=$PWD/build/c4group tools/make_System.c4g.sh
- name: "Windows: Collect binaries"
if: ${{ matrix.env == 'Windows' }}
run: |
cd build
mv *.{exe,pdb} ../output
- name: "Linux: Collect binaries"
if: ${{ matrix.env == 'Linux' }}
run: |
cd build
cp clonk c4group ../output
- name: "Linux: Create AppImage"
if: ${{ matrix.env == 'Linux' }}
run: |
tools/make_AppImage.sh
- name: "Mac: Create Bundle"
if: ${{ matrix.env == 'Mac' }}
run: |
cd build
DESTDIR=inst ninja install
mv inst/usr/local/c4group inst/usr/local/clonk.app ../output
- name: "Publish Main Artifact"
uses: actions/upload-artifact@v3
with:
name: ${{ env.CONFIG_SUFFIX }}
path: output/*
- name: "Publish System.c4g"
if: ${{ matrix.env == 'Linux' }}
uses: actions/upload-artifact@v3
with:
name: System.c4g
path: System.c4g
- name: "Publish Graphics.c4g"
if: ${{ matrix.env == 'Linux' && matrix.config != 'Debugrec' }}
uses: actions/upload-artifact@v3
with:
name: Graphics.c4g
path: Graphics.c4g
- name: "Pack: Windows"
if: ${{ matrix.env == 'Windows' }}
run: |
cd output
7z a LegacyClonk-$CONFIG_SUFFIX.zip *
- name: "Pack: Linux"
if: ${{ matrix.env == 'Linux' }}
run: |
cd output
mv clonk.AppImage clonk
tar czf LegacyClonk-$CONFIG_SUFFIX.tar.gz *
- name: "Pack: Mac"
if: ${{ matrix.env == 'Mac' }}
run: |
cd output
zip -r LegacyClonk-$CONFIG_SUFFIX.zip *
- name: "Release: Windows / Mac"
uses: ncipollo/release-action@v1.11.2
if: ${{ env.IS_RELEASE == 'true' && matrix.env != 'Linux' }}
with:
artifacts: output/LegacyClonk-${{ env.CONFIG_SUFFIX }}.zip
allowUpdates: true
artifactErrorsFailBuild: true
replacesArtifacts: true
generateReleaseNotes: true
- name: "Release: Linux"
uses: ncipollo/release-action@v1.11.2
if: ${{ env.IS_RELEASE == 'true' && matrix.env == 'Linux' }}
with:
artifacts: output/LegacyClonk-${{ env.CONFIG_SUFFIX }}.tar.gz
allowUpdates: true
artifactErrorsFailBuild: true
replacesArtifacts: true
generateReleaseNotes: true
- name: "Release: c4gs"
uses: ncipollo/release-action@v1.11.2
if: ${{ env.IS_RELEASE == 'true' && matrix.env == 'Linux' && matrix.config != 'Debugrec' }}
with:
artifacts: |
System.c4g
Graphics.c4g
allowUpdates: true
artifactErrorsFailBuild: true
replacesArtifacts: true
generateReleaseNotes: true