-
-
Notifications
You must be signed in to change notification settings - Fork 380
198 lines (161 loc) · 5.64 KB
/
build-ci.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
# Test all pull requests to ensure they build
name: Build Pioneer
# Controls when the action will run.
on:
push:
branches:
- master
pull_request:
paths:
- 'src/**.cpp'
- 'src/**.h'
- '**/CMakeLists.txt'
- '.github/workflows/build-ci.yml'
- '.github/actions/*/action.yml'
- 'cmake/*.cmake'
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref == 'refs/heads/master' }}
env:
packages: >
mesa-common-dev
libfreeimage-dev
libglew-dev
libsigc++-2.0-dev
libvorbis-dev
libassimp-dev
libsdl2-dev
libsdl2-image-dev
ninja-build
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-msvc:
runs-on: windows-2019
steps:
- name: Install Dependencies
run: |
choco install gawk -y
- uses: actions/checkout@v4
with:
path: pioneer
- name: Checkout pioneer-thirdparty
uses: actions/checkout@v4
with:
repository: pioneerspacesim/pioneer-thirdparty
path: pioneer-thirdparty
- name: Build MSVC
shell: cmd
run: |
for /f %%i in ('echo ${{ github.ref }} ^| awk -F "/" "/pull/ { print \"PR#\"$3 } /heads/ { print $3 }"') do set PROJECT_VERSION_INFO=%%i
echo Project Version: %PROJECT_VERSION_INFO%
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd pioneer
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX="C:/Program Files/Pioneer" -DPIONEER_DATA_DIR="C:/Program Files/Pioneer/data" -DCMAKE_BUILD_TYPE:STRING=Release -DGIT_EXECUTABLE="c:/Program Files/Git/cmd/git.exe" -DPROJECT_VERSION_INFO="%PROJECT_VERSION_INFO%"
cmake --build .
- name: Build Pioneer Data
shell: cmd
run: |
cd pioneer
modelcompiler.exe -b inplace
- name: Build Release
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd pioneer
cd build
cmake --build . --target install
cmake --build . --target win-installer
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: Windows-Artifacts
path: pioneer/pioneer-*-win.exe
retention-days: 14
compression-level: 0 # contains a pre-compressed self-extracting archive...
- name: Upload Release Files
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'release' }}
with:
files: pioneer/pioneer-*-win.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-gcc:
runs-on: ubuntu-20.04
steps:
# Checkout the repository as $GITHUB_WORKSPACE
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-fast update
sudo apt-fast install -y ${{ env.packages }}
- name: Setup CMake
run: |
echo "Project Version: $(echo "${{ github.ref }}" | awk -F '/' '/pull/ { print "PR#"$3 } /heads/ { print $3 }')"
cp scripts/CMakeBuildPresetsCI.json CMakeUserPresets.json
cmake -G Ninja --preset linux-x64-release -DPROJECT_VERSION_INFO=$(echo "${{ github.ref }}" | awk -F '/' '/pull/ { print "PR#"$3 } /heads/ { print $3 }')
- name: Build GCC
run: cmake --build ./build --target all
- name: Build Pioneer Data
run: cmake --build ./build --target build-data
- name: Run Tests
run: ./build/unittest
- name: Generate Artifacts
uses: ./.github/actions/upload-linux
with:
artifact_name: Linux 64-bit
build_slug: linux-x64-release
token: ${{ secrets.GITHUB_TOKEN }}
upload_release: true
build-clang:
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checkout the repository as $GITHUB_WORKSPACE
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-fast update
sudo apt-fast install -y clang-8 ${{ env.packages }}
- name: Setup CMake
run: |
echo "Project Version: $(echo "${{ github.ref }}" | awk -F '/' '/pull/ { print "PR#"$3 } /heads/ { print $3 }')"
cp scripts/CMakeBuildPresetsCI.json CMakeUserPresets.json
export CC=clang CXX=clang++
cmake -G Ninja --preset linux-x64-release -DPROJECT_VERSION_INFO=$(echo "${{ github.ref }}" | awk -F '/' '/pull/ { print "PR#"$3 } /heads/ { print $3 }')
- name: Build Clang
run: cmake --build ./build --target all
- name: Build Pioneer Data
run: cmake --build ./build --target build-data
- name: Run Tests
run: ./build/unittest
build-appimage:
runs-on: ubuntu-20.04
if: ${{github.event_name == 'release'}}
steps:
# Checkout the repository as $GITHUB_WORKSPACE
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-fast update
sudo apt-fast install -y ${{ env.packages }}
- name: Setup CMake
run: |
cp scripts/CMakeBuildPresetsCI.json CMakeUserPresets.json
cmake -G Ninja --preset linux-x64-release-appimage
- name: Build GCC
run: cmake --build ./build --target all
- name: Build Pioneer Data
run: cmake --build ./build --target build-data
- name: Run Tests
run: ./build/unittest
- name: Generate Artifacts
uses: ./.github/actions/upload-appimage
with:
artifact_name: Linux 64-bit Appimage
build_slug: linux-x64-release-appimage
token: ${{ secrets.GITHUB_TOKEN }}
upload_release: true