Skip to content

Commit 04e2f42

Browse files
committed
update CI
* combined the two create release and upload release steps into one job by using `continue-on-error: true` * use newer actions/checkout@v4 * cache cmake build/_deps folder * use bash by default for the build.yml file
1 parent e78d587 commit 04e2f42

File tree

1 file changed

+36
-48
lines changed

1 file changed

+36
-48
lines changed

.github/workflows/builds.yml

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,79 @@
11
name: builds
22

3-
# on: [push, pull_request]
43
on:
54
push:
65
tags:
76
- 'v*'
87

8+
defaults:
9+
run:
10+
shell: bash
11+
912
jobs:
1013

1114
build:
1215
permissions: write-all
1316

14-
name: ${{ matrix.platform.name }} ${{ matrix.config.name }}
17+
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.build.name }}
1518
runs-on: ${{ matrix.platform.os }}
1619

1720
strategy:
1821
fail-fast: false
1922
matrix:
2023
platform:
21-
- { name: Linux Clang, os: ubuntu-latest, font: ./build/bin/calibril.ttf, bin: ./build/bin/flappy_ffnn_ga, zip: ubuntu-executable-clang.zip, zipper: zip, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
24+
- { name: Windows VS2019, os: windows-2019, font: .\\build\\bin\\calibril.ttf, bin: .\\build\\bin\\Release\\flappy_ffnn_ga.exe, zip: windows-executable-VS19.zip, zipper: 7z a -tzip }
25+
- { name: Windows VS2022, os: windows-2022, font: .\\build\\bin\\calibril.ttf, bin: .\\build\\bin\\Release\\flappy_ffnn_ga.exe, zip: windows-executable-VS22.zip, zipper: 7z a -tzip }
26+
# - { name: Windows Clang, os: windows-latest, font: .\\build\\bin\\calibril.ttf, bin: .\\build\\bin\\Release\\flappy_ffnn_ga.exe, zip: windows-executable-clang.zip, zipper: 7z a -tzip, flags: -G "Unix Makefiles" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
27+
# - { name: Windows GCC, os: windows-latest, font: .\\build\\bin\\calibril.ttf, bin: .\\build\\bin\\Release\\flappy_ffnn_ga.exe, zip: windows-executable-gcc.zip, zipper: 7z a -tzip, flags: -G "Unix Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ }
28+
- { name: MacOS , os: macos-latest, font: ./build/bin/calibril.ttf, bin: ./build/bin/flappy_ffnn_ga, zip: mac-executable.zip, zipper: zip }
29+
- { name: Linux GCC, os: ubuntu-latest, font: ./build/bin/calibril.ttf, bin: ./build/bin/flappy_ffnn_ga, zip: ubuntu-executable-gcc.zip, zipper: zip }
30+
- { name: Linux Clang, os: ubuntu-latest, font: ./build/bin/calibril.ttf, bin: ./build/bin/flappy_ffnn_ga, zip: ubuntu-executable-clang.zip, zipper: zip, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
2231
config:
23-
- { name: static, flags: -DBUILD_SHARED_LIBS=FALSE -DCMAKE_BUILD_TYPE=Release }
32+
- { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
33+
# - { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
34+
build:
35+
- { name: Release, flag: -DCMAKE_BUILD_TYPE=Release }
36+
# - { name: Debug, flag: -DCMAKE_BUILD_TYPE=Debug }
37+
# - { name: RelWithDebInfo, flag: -DCMAKE_BUILD_TYPE=RelWithDebInfo }
38+
# - { name: MinSizeRel, flag: -DCMAKE_BUILD_TYPE=MinSizeRel }
2439

2540
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
44+
- name: Cache Dependencies
45+
uses: actions/cache@v3
46+
id: CMakeFetchContent
47+
with:
48+
path: build/_deps
49+
key: ${{ matrix.platform.zip }}-${{ hashFiles('**/CMakeLists.txt') }}
50+
restore-keys: |
51+
${{ matrix.platform.zip }}-
52+
2653
- name: Install Linux Dependencies
54+
if: runner.os == 'Linux'
2755
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
2856

29-
- name: Checkout
30-
uses: actions/checkout@v3
31-
3257
- name: Display Tag Name
3358
run : echo ${{github.ref_name}}
3459

3560
- name: Configure project
36-
run: cmake -S src -B build -DCMAKE_INSTALL_PREFIX=install ${{matrix.platform.flags}} ${{matrix.config.flags}}
61+
run: cmake -S src -B build ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.build.flag}}
3762

3863
- name: Build ${{matrix.platform.bin}} executable
39-
run: cmake --build build --config Release
64+
run: cmake --build build --config ${{matrix.build.name}}
4065

4166
- name: Compress ${{matrix.platform.bin}} executable
4267
run: ${{matrix.platform.zipper}} ${{matrix.platform.zip}} ${{matrix.platform.bin}} ${{matrix.platform.font}}
4368

4469
- name: Create github release and upload ${{matrix.platform.zip}}
70+
continue-on-error: true
4571
run: gh release create ${{github.ref_name}} ${{matrix.platform.zip}} --title "${{github.ref_name}}" --notes "Release notes for ${{github.ref_name}}" --draft=false --prerelease=false
4672
env:
4773
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4874

49-
build-others:
50-
needs: build
51-
permissions: write-all
52-
53-
name: ${{ matrix.platform.name }} ${{ matrix.config.name }}
54-
runs-on: ${{ matrix.platform.os }}
55-
56-
strategy:
57-
fail-fast: false
58-
matrix:
59-
platform:
60-
- { name: Windows VS2019, os: windows-2019, font: .\\build\\bin\\calibril.ttf, bin: .\\build\\bin\\Release\\flappy_ffnn_ga.exe, zip: windows-executable-VS19.zip, zipper: 7z a -tzip, flags: -DBUILD_SHARED_LIBS=FALSE -DCMAKE_BUILD_TYPE=Release }
61-
- { name: Windows VS2022, os: windows-2022, font: .\\build\\bin\\calibril.ttf, bin: .\\build\\bin\\Release\\flappy_ffnn_ga.exe, zip: windows-executable-VS22.zip, zipper: 7z a -tzip, flags: -DBUILD_SHARED_LIBS=FALSE -DCMAKE_BUILD_TYPE=Release }
62-
- { name: Windows Clang, os: windows-latest, font: .\\build\\bin\\calibril.ttf, bin: .\\build\\bin\\Release\\flappy_ffnn_ga.exe, zip: windows-executable-clang.zip, zipper: 7z a -tzip, flags: -DBUILD_SHARED_LIBS=FALSE -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
63-
- { name: Windows GCC, os: windows-latest, font: .\\build\\bin\\calibril.ttf, bin: .\\build\\bin\\Release\\flappy_ffnn_ga.exe, zip: windows-executable-gcc.zip, zipper: 7z a -tzip, flags: -DBUILD_SHARED_LIBS=FALSE -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ }
64-
- { name: MacOS XCode, os: macos-latest, font: ./build/bin/calibril.ttf, bin: ./build/bin/flappy_ffnn_ga, zip: mac-executable.zip, zipper: zip, flags: -DBUILD_SHARED_LIBS=FALSE -DCMAKE_BUILD_TYPE=Release }
65-
- { name: Linux GCC, os: ubuntu-latest, font: ./build/bin/calibril.ttf, bin: ./build/bin/flappy_ffnn_ga, zip: ubuntu-executable-gcc.zip, zipper: zip, flags: -DBUILD_SHARED_LIBS=FALSE -DCMAKE_BUILD_TYPE=Release }
66-
config:
67-
- { name: static, flags: -DBUILD_SHARED_LIBS=FALSE -DCMAKE_BUILD_TYPE=Release }
68-
# - { name: shared, flags: -DBUILD_SHARED_LIBS=TRUE -DCMAKE_BUILD_TYPE=Release }
69-
70-
steps:
71-
72-
- name: Checkout Repository
73-
uses: actions/checkout@v3
74-
75-
- name: Install Linux Dependencies
76-
if: runner.os == 'Linux'
77-
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
78-
79-
- name: Configure project
80-
run: cmake -S src -B build -DCMAKE_INSTALL_PREFIX=install ${{matrix.platform.flags}} ${{matrix.config.flags}}
81-
82-
- name: Build ${{matrix.platform.bin}} executable
83-
run: cmake --build build --config Release
84-
85-
- name: Compress ${{matrix.platform.bin}} executable
86-
run: ${{matrix.platform.zipper}} ${{matrix.platform.zip}} ${{matrix.platform.bin}} ${{matrix.platform.font}}
87-
8875
- name: Upload ${{matrix.platform.zip}} to release
76+
continue-on-error: true
8977
run: gh release upload ${{github.ref_name}} ${{matrix.platform.zip}}
9078
env:
9179
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)