Skip to content

Commit 4b7013f

Browse files
authored
Merge pull request #3001 from asarium/ci/githubReleaseBuilds
Add GitHub workflow for building releases
2 parents ded3131 + 10d7417 commit 4b7013f

File tree

6 files changed

+311
-33
lines changed

6 files changed

+311
-33
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
tags:
66
- 'nightly_*'
7-
- 'release_*'
87

98
env:
109
QT_VERSION: 5.12.9
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
name: Build distribution package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'release_*'
7+
8+
env:
9+
QT_VERSION: 5.12.9
10+
11+
jobs:
12+
create_release:
13+
name: Create GitHub release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Create Release
17+
id: create_release
18+
uses: actions/create-release@v1
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
21+
with:
22+
tag_name: ${{ github.ref }}
23+
release_name: Release ${{ github.ref }}
24+
draft: false
25+
prerelease: false
26+
- name: Store upload URL
27+
run: |
28+
echo -n "${{ steps.create_release.outputs.upload_url }}" > upload_url
29+
- name: Persist upload URL
30+
uses: actions/upload-artifact@v2
31+
with:
32+
name: upload_url
33+
path: ${{ github.workspace }}/upload_url
34+
35+
build_linux:
36+
strategy:
37+
matrix:
38+
configuration: [FastDebug, Release]
39+
name: Linux
40+
needs: create_release
41+
runs-on: ubuntu-latest
42+
container: ghcr.io/scp-fs2open/linux_build:sha-a8ca321
43+
steps:
44+
- name: Cache Qt
45+
id: cache-qt-lin
46+
uses: actions/cache@v1
47+
with:
48+
path: ${{ github.workspace }}/../Qt
49+
key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }}
50+
- name: Install Qt
51+
uses: jurplel/install-qt-action@v2
52+
with:
53+
version: ${{ env.QT_VERSION }}
54+
dir: ${{ github.workspace }}/..
55+
cached: ${{ steps.cache-qt-lin.outputs.cache-hit }}
56+
57+
- uses: actions/checkout@v1
58+
name: Checkout
59+
with:
60+
submodules: true
61+
- name: Configure CMake
62+
env:
63+
CONFIGURATION: ${{ matrix.configuration }}
64+
COMPILER: gcc-5
65+
run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh
66+
- name: Compile
67+
working-directory: ./build
68+
env:
69+
CONFIGURATION: ${{ matrix.configuration }}
70+
run: |
71+
LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH ninja -k 20 all
72+
- name: Run Tests
73+
working-directory: ./build
74+
env:
75+
CONFIGURATION: ${{ matrix.configuration }}
76+
XDG_RUNTIME_DIR: /root
77+
run: $GITHUB_WORKSPACE/ci/linux/run_tests.sh
78+
- name: Generate AppImage
79+
working-directory: ./build
80+
env:
81+
CONFIGURATION: ${{ matrix.configuration }}
82+
run: $GITHUB_WORKSPACE/ci/linux/generate_appimage.sh $GITHUB_WORKSPACE/build/install
83+
- name: Upload build result
84+
uses: actions/upload-artifact@v2
85+
with:
86+
name: linux-${{ matrix.configuration }}
87+
path: ${{ github.workspace }}/build/install/*.AppImage
88+
linux_zip:
89+
name: Build Linux distribution zip
90+
needs: build_linux
91+
runs-on: ubuntu-latest
92+
container: ghcr.io/scp-fs2open/sftp_upload:sha-dd9d8cf
93+
steps:
94+
- uses: actions/checkout@v1
95+
name: Checkout
96+
with:
97+
submodules: true
98+
fetch-depth: '0'
99+
- name: Download upload URL
100+
uses: actions/download-artifact@v1
101+
with:
102+
name: upload_url
103+
path: .
104+
- name: Extract upload URL
105+
id: extractUploadUrl
106+
run: echo "::set-output name=upload_url::$(cat upload_url)"
107+
- name: Download Release builds
108+
uses: actions/download-artifact@v1
109+
with:
110+
name: linux-Release
111+
path: builds
112+
- name: Download FastDebug builds
113+
uses: actions/download-artifact@v2
114+
with:
115+
name: linux-FastDebug
116+
path: builds
117+
- name: Create Distribution package
118+
id: generate_package
119+
working-directory: ./builds
120+
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Linux
121+
- name: Upload result package
122+
uses: actions/upload-release-asset@v1
123+
env:
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
with:
126+
upload_url: ${{ steps.extractUploadUrl.outputs.upload_url }}
127+
asset_path: ${{ steps.generate_package.outputs.package_path }}
128+
asset_name: ${{ steps.generate_package.outputs.package_name }}
129+
# All builds are zips at the moment so this is fine for now
130+
asset_content_type: application/zip
131+
132+
build_windows:
133+
strategy:
134+
matrix:
135+
configuration: [FastDebug, Release]
136+
arch: [Win32, x64]
137+
simd: [SSE2, AVX]
138+
needs: create_release
139+
name: Windows
140+
runs-on: windows-2019
141+
steps:
142+
- uses: actions/checkout@v1
143+
name: Checkout
144+
with:
145+
submodules: true
146+
- name: Cache Qt
147+
id: cache-qt-win
148+
uses: actions/cache@v1
149+
with:
150+
path: ${{ github.workspace }}/../Qt
151+
key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }}
152+
- name: Install Qt (32 bit)
153+
uses: jurplel/install-qt-action@v2
154+
if: ${{ matrix.arch == 'Win32' }}
155+
with:
156+
version: ${{ env.QT_VERSION }}
157+
dir: ${{ github.workspace }}/..
158+
arch: win32_msvc2017
159+
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
160+
aqtversion: ==0.8
161+
- name: Install Qt (64 bit)
162+
uses: jurplel/install-qt-action@v2
163+
if: ${{ matrix.arch == 'x64' }}
164+
with:
165+
version: ${{ env.QT_VERSION }}
166+
dir: ${{ github.workspace }}/..
167+
arch: win64_msvc2017_64
168+
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
169+
aqtversion: ==0.8
170+
171+
- name: Configure CMake
172+
env:
173+
CONFIGURATION: ${{ matrix.configuration }}
174+
ARCHITECTURE: ${{ matrix.arch }}
175+
SIMD: ${{ matrix.simd }}
176+
shell: bash
177+
run: |
178+
mkdir build
179+
cd build
180+
181+
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
182+
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
183+
-DFSO_BUILD_QTFRED=ON -DFSO_BUILD_TESTS=ON \
184+
-DFSO_INSTALL_DEBUG_FILES="ON" -A "$ARCHITECTURE" \
185+
-G "Visual Studio 16 2019" -T "v142" ..
186+
- name: Compile
187+
working-directory: ./build
188+
env:
189+
CONFIGURATION: ${{ matrix.configuration }}
190+
COMPILER: ${{ matrix.compiler }}
191+
shell: bash
192+
run: |
193+
cmake --build . --config "$CONFIGURATION" --target INSTALL -- /verbosity:minimal
194+
ls -alR "$(pwd)/install"
195+
- name: Run Tests
196+
working-directory: ./build
197+
env:
198+
CONFIGURATION: ${{ matrix.configuration }}
199+
shell: bash
200+
run: ./bin/$CONFIGURATION/unittests --gtest_shuffle
201+
- name: Upload build result
202+
uses: actions/upload-artifact@v2
203+
with:
204+
name: windows-${{ matrix.configuration }}-${{ matrix.arch }}-${{ matrix.simd }}
205+
path: ${{ github.workspace }}/build/install/*
206+
windows_zip:
207+
name: Build Windows distribution zip
208+
needs: build_windows
209+
runs-on: ubuntu-latest
210+
container: ghcr.io/scp-fs2open/sftp_upload:sha-dd9d8cf
211+
strategy:
212+
matrix:
213+
arch: [Win32, x64]
214+
simd: [SSE2, AVX]
215+
steps:
216+
- uses: actions/checkout@v1
217+
name: Checkout
218+
with:
219+
submodules: true
220+
fetch-depth: '0'
221+
- name: Download upload URL
222+
uses: actions/download-artifact@v1
223+
with:
224+
name: upload_url
225+
path: .
226+
- name: Extract upload URL
227+
id: extractUploadUrl
228+
run: echo "::set-output name=upload_url::$(cat upload_url)"
229+
- name: Download Release builds
230+
uses: actions/download-artifact@v1
231+
with:
232+
name: windows-Release-${{ matrix.arch }}-${{ matrix.simd }}
233+
path: builds
234+
- name: Download FastDebug builds
235+
uses: actions/download-artifact@v2
236+
with:
237+
name: windows-FastDebug-${{ matrix.arch }}-${{ matrix.simd }}
238+
path: builds
239+
- name: Create Distribution package
240+
id: generate_package
241+
working-directory: ./builds
242+
shell: bash
243+
env:
244+
ARCH: ${{ matrix.arch }}
245+
SIMD: ${{ matrix.simd }}
246+
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Windows
247+
- name: Upload result package
248+
uses: actions/upload-release-asset@v1
249+
env:
250+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
251+
with:
252+
upload_url: ${{ steps.extractUploadUrl.outputs.upload_url }}
253+
asset_path: ${{ steps.generate_package.outputs.package_path }}
254+
asset_name: ${{ steps.generate_package.outputs.package_name }}
255+
# All builds are zips at the moment so this is fine for now
256+
asset_content_type: application/zip

ci/appveyor/build.ps1

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,38 @@ $NightlyConfigurations = @(
2727
# }
2828
)
2929
$ReleaseConfigurations = @(
30-
[BuildConfig]@{
31-
Generator="Visual Studio 14 2015";
32-
PackageType="Win32";
33-
Toolset="v140";
34-
SimdType="SSE2";
35-
QtDir="C:\Qt\5.9\msvc2015";
36-
SourcePackage=$true;
37-
}
38-
[BuildConfig]@{
39-
Generator="Visual Studio 14 2015";
40-
PackageType="Win32-AVX";
41-
Toolset="v140";
42-
SimdType="AVX";
43-
QtDir="C:\Qt\5.9\msvc2015";
44-
SourcePackage=$false;
45-
}
46-
[BuildConfig]@{
47-
Generator="Visual Studio 14 2015 Win64";
48-
PackageType="Win64";
49-
Toolset="v140";
50-
SimdType="SSE2";
51-
QtDir="C:\Qt\5.9\msvc2015_64";
52-
SourcePackage=$false;
53-
}
54-
[BuildConfig]@{
55-
Generator="Visual Studio 14 2015 Win64";
56-
PackageType="Win64-AVX";
57-
Toolset="v140";
58-
SimdType="AVX";
59-
QtDir="C:\Qt\5.9\msvc2015_64";
60-
SourcePackage=$false;
61-
}
30+
# [BuildConfig]@{
31+
# Generator="Visual Studio 14 2015";
32+
# PackageType="Win32";
33+
# Toolset="v140";
34+
# SimdType="SSE2";
35+
# QtDir="C:\Qt\5.9\msvc2015";
36+
# SourcePackage=$true;
37+
# }
38+
# [BuildConfig]@{
39+
# Generator="Visual Studio 14 2015";
40+
# PackageType="Win32-AVX";
41+
# Toolset="v140";
42+
# SimdType="AVX";
43+
# QtDir="C:\Qt\5.9\msvc2015";
44+
# SourcePackage=$false;
45+
# }
46+
# [BuildConfig]@{
47+
# Generator="Visual Studio 14 2015 Win64";
48+
# PackageType="Win64";
49+
# Toolset="v140";
50+
# SimdType="SSE2";
51+
# QtDir="C:\Qt\5.9\msvc2015_64";
52+
# SourcePackage=$false;
53+
# }
54+
# [BuildConfig]@{
55+
# Generator="Visual Studio 14 2015 Win64";
56+
# PackageType="Win64-AVX";
57+
# Toolset="v140";
58+
# SimdType="AVX";
59+
# QtDir="C:\Qt\5.9\msvc2015_64";
60+
# SourcePackage=$false;
61+
# }
6262
)
6363

6464
$BuildConfigurations = $null

ci/linux/create_dist_pack.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ source $HERE/dist_functions.sh
99

1010
if [ "$OS" = "Linux" ]; then
1111
tar -cvzf "$(get_package_name)-builds-Linux.tar.gz" *
12+
13+
echo "::set-output name=package_path::$(pwd)/$(get_package_name)-builds-Linux.tar.gz"
14+
echo "::set-output name=package_name::$(get_package_name)-builds-Linux.tar.gz"
1215
elif [ "$OS" = "Windows" ]; then
1316
7z a -xr'!*.pdb' "$(get_package_name)-builds-$ARCH-$SIMD.zip" "*"
1417

18+
echo "::set-output name=package_path::$(pwd)/$(get_package_name)-builds-$ARCH-$SIMD.zip"
19+
echo "::set-output name=package_name::$(get_package_name)-builds-$ARCH-$SIMD.zip"
20+
1521
7z a "$(get_package_name)-debug-$ARCH-$SIMD.7z" "*.pdb"
1622
else
1723
echo "Invalid OS: $OS"

ci/linux/dist_functions.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ function get_package_name() {
44
return
55
fi
66

7+
if git describe --match 'release_*' --exact-match >/dev/null; then
8+
echo -n "$(git describe --match "release_*" --exact-match | sed 's/release_/fs2_open_/i')"
9+
return
10+
fi
11+
712
echo "unknown_config"
813
}
914

@@ -18,6 +23,16 @@ function get_version_name() {
1823
return
1924
fi
2025

26+
if git describe --match 'release_*' --exact-match >/dev/null; then
27+
local tag_name=$(git describe --match "release_*" --exact-match)
28+
29+
# Use the bash regex matching for getting the relevant part of the tag name
30+
[[ $tag_name =~ ^release_(.*)$ ]]
31+
32+
echo -n "${BASH_REMATCH[1]}"
33+
return
34+
fi
35+
2136
echo "unknown_config"
2237
}
2338

ci/linux/generate_appimage.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_FOLDER -DCOMPONENT=Freespace2 -P cmake_ins
99
# We need to be a bit creative for determining the AppImage name since we don't want to hard-code the name
1010
FILENAME="$(find $INSTALL_FOLDER/bin -name 'fs2_open_*' -type f -printf "%f\n").AppImage"
1111
appimagetool -n $INSTALL_FOLDER "$INSTALL_FOLDER/$FILENAME"
12+
chmod +x "$INSTALL_FOLDER/$FILENAME"
13+
1214
ls -al $INSTALL_FOLDER

0 commit comments

Comments
 (0)