Skip to content

Commit 383d2e5

Browse files
committed
Improve CI
This commit improves GitHub Actions by using matrix and sending artifacts.
1 parent a6c26f4 commit 383d2e5

9 files changed

+165
-208
lines changed

.github/workflows/build.yml

+97-101
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,107 @@
11
name: Build
22

33
on: [push, pull_request]
4+
env:
5+
WAF_FLAGS: -T release --disable-warns --prefix=build_hl2
46

57
jobs:
6-
build-linux-i386:
7-
runs-on: ubuntu-latest
8-
9-
steps:
10-
- uses: actions/checkout@v2
11-
- name: Build linux-i386
12-
run: |
13-
scripts/build-ubuntu-i386.sh
14-
15-
build-linux-amd64:
16-
runs-on: ubuntu-20.04
17-
18-
steps:
19-
- uses: actions/checkout@v2
20-
- name: Build linux-amd64
21-
run: |
22-
scripts/build-ubuntu-amd64.sh
23-
24-
build-android-armv7a:
25-
runs-on: ubuntu-20.04
26-
27-
steps:
28-
- uses: actions/checkout@v2
29-
- name: Build android-armv7a
30-
run: |
31-
scripts/build-android-armv7a.sh
32-
33-
build-windows-i386:
34-
runs-on: windows-2019
35-
36-
steps:
37-
- uses: actions/checkout@v2
38-
- name: Build windows-i386
39-
run: |
40-
git submodule init && git submodule update
41-
./waf.bat configure -T debug
42-
./waf.bat build
43-
44-
build-windows-amd64:
45-
runs-on: windows-2019
46-
47-
steps:
48-
- uses: actions/checkout@v2
49-
- name: Build windows-amd64
50-
run: |
51-
git submodule init && git submodule update
52-
./waf.bat configure -T debug -8
53-
./waf.bat build
54-
55-
build-dedicated-windows-i386:
56-
runs-on: windows-2019
57-
58-
steps:
59-
- uses: actions/checkout@v2
60-
- name: Build dedicated windows-i386
61-
run: |
62-
git submodule init && git submodule update
63-
./waf.bat configure -T debug -d
64-
./waf.bat build
65-
66-
build-dedicated-windows-amd64:
67-
runs-on: windows-2019
68-
8+
build-linux:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-latest]
13+
bits: ['', '--64bits']
14+
android: ['']
15+
flags: ['', '-d']
16+
include:
17+
- os: ubuntu-20.04
18+
bits: ''
19+
android: '--android=armeabi-v7a-hard,4.9,21 --togles'
20+
flags: ''
21+
runs-on: ${{ matrix.os }}
22+
env:
23+
DEPS: libopenal-dev libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libcurl4-gnutls-dev libsdl2-dev zlib1g-dev libbz2-dev libedit-dev
6924
steps:
70-
- uses: actions/checkout@v2
71-
- name: Build dedicated windows-amd64
72-
run: |
73-
git submodule init && git submodule update
74-
./waf.bat configure -T debug -d -8
75-
./waf.bat build
76-
77-
build-dedicated-linux-i386:
78-
runs-on: ubuntu-20.04
79-
80-
steps:
81-
- uses: actions/checkout@v2
82-
- name: Build dedicated linux-i386
83-
run: |
84-
scripts/build-ubuntu-i386.sh -d
85-
86-
build-dedicated-linux-amd64:
87-
runs-on: ubuntu-20.04
88-
89-
steps:
90-
- uses: actions/checkout@v2
91-
- name: Build dedicated linux-amd64
92-
run: |
93-
scripts/build-ubuntu-amd64.sh -d
94-
95-
build-macos-amd64:
25+
- uses: actions/checkout@v3
26+
with:
27+
submodules: recursive
28+
29+
- name: Install common dependencies
30+
run: sudo apt-get update && sudo apt-get install -y g++-multilib gcc-multilib
31+
- name: Install 32bit dependencies
32+
if: ${{ matrix.bits == '' && !matrix.android }}
33+
run: |
34+
sudo dpkg --add-architecture i386
35+
sudo apt-get update
36+
sudo apt-get install -y aptitude
37+
sudo aptitude install -y $(echo $DEPS | sed -r 's/[a-z0-9_\-]+/&:i386/g')
38+
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig" >> $GITHUB_ENV
39+
- name: Install 64bit dependencies
40+
if: ${{ matrix.bits != '' }}
41+
run: |
42+
sudo apt-get install -y $DEPS
43+
- name: Install Android dependencies
44+
if: ${{ matrix.android != '' }}
45+
run: |
46+
wget https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip -o /dev/null
47+
unzip android-ndk-r10e-linux-x86_64.zip
48+
export NDK_HOME=$PWD/android-ndk-r10e/
49+
echo "NDK_HOME=$NDK_HOME" >> $GITHUB_ENV
50+
echo "ANDROID_NDK_HOME=$NDK_HOME" >> $GITHUB_ENV
51+
52+
- name: Configure
53+
run: ./waf configure ${{ matrix.bits }} ${{ matrix.android }} ${{ matrix.flags }} $WAF_FLAGS
54+
- name: Build ${{ matrix.os }}
55+
run: ./waf install
56+
- name: Tar binaries
57+
run: tar cvf build.tar build_hl2
58+
- name: Upload artifact
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: Linux${{matrix.bits}}${{matrix.flags}}${{matrix.android}}.tar
62+
path: build.tar
63+
64+
build-macos:
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
flags: ['', '-d']
9669
runs-on: macos-latest
97-
9870
steps:
99-
- uses: actions/checkout@v2
100-
- name: Build macos-amd64
101-
run: |
102-
scripts/build-macos-amd64.sh
71+
- uses: actions/checkout@v3
72+
with:
73+
submodules: recursive
74+
75+
- name: Install dependencies
76+
run: brew install sdl2
77+
78+
- name: Configure
79+
run: ./waf configure --64bits ${{ matrix.flags }} $WAF_FLAGS
80+
- name: Build macos-amd64
81+
run: ./waf install
82+
- name: Tar binaries
83+
run: tar cvf build.tar build_hl2
84+
- name: Upload artifact
85+
uses: actions/upload-artifact@v3
86+
with:
87+
name: macOS--64bits${{matrix.flags}}.tar
88+
path: build.tar
89+
90+
build-windows:
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
os: [windows-2019]
95+
bits: ['', '--64bits']
96+
flags: ['', '-d']
97+
runs-on: ${{ matrix.os }}
98+
steps:
99+
- uses: actions/checkout@v3
100+
with:
101+
submodules: recursive
103102

104-
build-dedicated-macos-amd64:
105-
runs-on: macos-latest
103+
- name: Configure
104+
run: ./waf configure ${{ matrix.bits }} ${{ matrix.flags }} ${{ env.WAF_FLAGS }}
105+
- name: Build ${{ matrix.os }}
106+
run: ./waf install
106107

107-
steps:
108-
- uses: actions/checkout@v2
109-
- name: Build dedicated macos-amd64
110-
run: |
111-
scripts/build-macos-amd64.sh -d

.github/workflows/tests.yml

+68-44
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,83 @@
11
name: Tests
22

33
on: [push, pull_request]
4+
env:
5+
WAF_FLAGS: -T release --disable-warns --prefix=build_tests --tests --sanitize=address,undefined
46

57
jobs:
6-
tests-linux-i386:
7-
runs-on: ubuntu-20.04
8-
8+
tests-linux:
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, ubuntu-20.04]
12+
bits: ['', '--64bits']
13+
android: ['']
14+
runs-on: ${{ matrix.os }}
15+
env:
16+
DEPS: libbz2-dev
917
steps:
10-
- uses: actions/checkout@v2
11-
- name: Run tests linux-i386
12-
run: |
13-
scripts/tests-ubuntu-i386.sh
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: recursive
1421

15-
tests-linux-amd64:
16-
runs-on: ubuntu-20.04
22+
- name: Install common dependencies
23+
run: sudo apt-get update && sudo apt-get install -y g++-multilib gcc-multilib
24+
- name: Install 32bit dependencies
25+
if: ${{ matrix.bits == '' && !matrix.android }}
26+
run: |
27+
sudo dpkg --add-architecture i386
28+
sudo apt-get update
29+
sudo apt-get install aptitude
30+
sudo aptitude install -y $(echo $DEPS | sed -r 's/[a-z0-9_\-]+/&:i386/g')
31+
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig" >> $GITHUB_ENV
32+
- name: Install 64bit dependencies
33+
if: ${{ matrix.bits != '' }}
34+
run: |
35+
sudo apt-get install -y $DEPS
1736
18-
steps:
19-
- uses: actions/checkout@v2
20-
- name: Run tests linux-amd64
21-
run: |
22-
scripts/tests-ubuntu-amd64.sh
37+
- name: Configure
38+
run: ./waf configure ${{ matrix.bits }} $WAF_FLAGS
39+
- name: Build ${{ matrix.os }}
40+
run: ./waf install
41+
- name: Run tests
42+
run: |
43+
cd build_tests
44+
LD_LIBRARY_PATH=bin/ ./unittest
2345
24-
tests-macos-amd64:
46+
tests-macos:
2547
runs-on: macos-latest
26-
2748
steps:
28-
- uses: actions/checkout@v2
29-
- name: Run tests macos-amd64
30-
run: |
31-
scripts/tests-macos-amd64.sh
49+
- uses: actions/checkout@v3
50+
with:
51+
submodules: recursive
3252

33-
tests-windows-i386:
34-
runs-on: windows-2019
53+
- name: Configure
54+
run: ./waf configure --64bits $WAF_FLAGS
55+
- name: Build macos-amd64
56+
run: ./waf install
57+
- name: Run tests
58+
run: |
59+
cd build_tests
60+
DYLD_LIBRARY_PATH=bin/ ./unittest
3561
62+
tests-windows:
63+
strategy:
64+
matrix:
65+
os: [windows-2019]
66+
bits: ['', '--64bits']
67+
runs-on: ${{ matrix.os }}
3668
steps:
37-
- uses: actions/checkout@v2
38-
- name: Run tests windows-i386
39-
run: |
40-
git submodule init && git submodule update
41-
./waf.bat configure -T release --tests --prefix=out/
42-
./waf.bat install
43-
cd out
44-
$env:Path = "bin";
45-
./unittest.exe
46-
47-
tests-windows-amd64:
48-
runs-on: windows-2019
69+
- uses: actions/checkout@v3
70+
with:
71+
submodules: recursive
72+
73+
- name: Configure
74+
run: ./waf configure ${{ matrix.bits }} ${{ env.WAF_FLAGS }}
75+
76+
- name: Build ${{ matrix.os }}
77+
run: ./waf install
78+
- name: Run tests
79+
run: |
80+
cd build_tests
81+
$env:Path = "bin";
82+
./unittest.exe
4983
50-
steps:
51-
- uses: actions/checkout@v2
52-
- name: Run tests windows-amd64
53-
run: |
54-
git submodule init && git submodule update
55-
./waf.bat configure -T release --tests --prefix=out/ -8
56-
./waf.bat install
57-
cd out
58-
$env:Path = "bin";
59-
./unittest.exe

scripts/build-android-armv7a.sh

-9
This file was deleted.

scripts/build-macos-amd64.sh

-8
This file was deleted.

scripts/build-ubuntu-amd64.sh

-8
This file was deleted.

scripts/build-ubuntu-i386.sh

-10
This file was deleted.

scripts/tests-macos-amd64.sh

-7
This file was deleted.

scripts/tests-ubuntu-amd64.sh

-10
This file was deleted.

0 commit comments

Comments
 (0)