-
Notifications
You must be signed in to change notification settings - Fork 90
179 lines (159 loc) · 5.03 KB
/
cmake.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
name: CMake
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
workflow_run:
workflows: [Docker Image]
types: [completed]
branches: [develop]
jobs:
build-linux:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
arch: [x64]
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
compiler: [gcc, clang]
runs-on: ${{ matrix.os }}
env:
MATRIX_COMPILER: ${{matrix.compiler}}
MATRIX_OS: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Get dependencies
run: |
echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates
sudo apt update
sudo apt remove -y firefox # save some time during upgrade
sudo apt upgrade -y
sudo mk/linux/setupBuildDeps.sh
- name: Build
run: |
if [ "${MATRIX_COMPILER}" = "clang" ]; then
EXTRA_OPTS="-f"
else
ADD_FLAGS="-flto=auto"
export CFLAGS=$ADD_FLAGS CXXFLAGS=$ADD_FLAGS
fi
mk/linux/build-mg.sh -m -d ${EXTRA_OPTS}
make -C mk/linux/build -j$(nproc) VERBOSE=1
build-win64-deps:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
arch: [x64]
build_type: [Release]
include:
- build_type: Release
release: 'ON'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Cache Vcpkg Libs
uses: actions/cache@v4
env:
cache-name: cache-vcpkg-deps
with:
path: c:/vcpkg/installed
key: vcpkg-deps
- name: Install Windows Deps
run: |
cd mk\windoze
$scriptDir = Get-Location
cd c:\vcpkg
& "$(Join-Path $scriptDir install-deps-vcpkg.ps1)"
build-win64:
needs: build-win64-deps
strategy:
fail-fast: false
matrix:
arch: [x64]
build_type: [Release]
include:
- build_type: Release
release: 'ON'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Get Vcpkg Libs Cache
uses: actions/cache@v4
env:
cache-name: cache-vcpkg-deps
with:
path: c:/vcpkg/installed
key: vcpkg-deps
- name: Build MegaGlest
run: |
cd mk/windoze
./build-mg-vs-cmake.ps1 -vcpkg-location c:/vcpkg/
- name: Git Hash
if: ${{ github.ref == 'refs/heads/develop' }}
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV
- name: Prepare Snapshot
if: ${{ github.ref == 'refs/heads/develop' }}
run: |
cd mk\windoze
Get-ChildItem *.exe | Rename-Item -NewName {$_.BaseName + "-$env:VERSION" + $_.Extension}
cp ..\shared\*.ini .
$7zPath = $(Get-Command 7z).Source
cp $7zPath .
Remove-Item glest-dev.ini
Compress-Archive -Path *.exe,*.ini -DestinationPath megaglest-$env:VERSION-x64-windows.zip
cd ../..
- name: Create MegaGlest Snapshot
if: ${{ github.ref == 'refs/heads/develop' }}
uses: actions/upload-artifact@v4
with:
name: megaglest-x64-windows
retention-days: 1
path: mk/windoze/*.zip
on-dockerbuild-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: |
echo 'The triggering workflow failed'
exit 1
build-macos:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Get dependencies
run: |
mk/macos/setupBuildDeps.sh
- name: Build MegaGlest With Clang Compiler
run: |
mk/macos/build-mg.sh -m
make -C mk/macos/build -j$(sysctl -n hw.ncpu) VERBOSE=1
- name: Git Hash
if: ${{ github.ref == 'refs/heads/develop' }}
run: |
echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Prepare Snapshot
if: ${{ github.ref == 'refs/heads/develop' }}
run: |
cd mk/macos
./make-binary-archive.sh
cd -
mv release/mg-binary-macos*.tar.bz2 release/megaglest-$VERSION-x64-macos.tar.bz2
- name: Create MegaGlest Snapshot
if: ${{ github.ref == 'refs/heads/develop' }}
uses: actions/upload-artifact@v4
with:
name: megaglest-x64-macos
retention-days: 1
path: release/*.tar.bz2