Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit b72fdb3

Browse files
authored
Merge pull request #499 from cortex-command-community/470-make-existing-build-workflows-reusable
Make existing build workflows reusable
2 parents 5a2e816 + 476294b commit b72fdb3

File tree

5 files changed

+179
-134
lines changed

5 files changed

+179
-134
lines changed

.github/workflows/build-check.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Continuous Integration
2+
3+
on:
4+
# Triggers the workflow for pushes to development, for pull request events, and for the merge queue
5+
push:
6+
branches: [development]
7+
pull_request:
8+
types: [opened, reopened, ready_for_review, synchronize]
9+
merge_group:
10+
types: [checks_requested]
11+
12+
workflow_dispatch:
13+
14+
# Cancel in-progress runs if newer changes to the same branch/PR are pushed.
15+
concurrency:
16+
group: ci-${{ github.head_ref || github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
meson:
21+
uses: ./.github/workflows/meson.yml
22+
23+
msbuild:
24+
uses: ./.github/workflows/msbuild.yml
25+

.github/workflows/master_build.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
name: Master Build
3+
4+
on:
5+
# Triggers the workflow for pushes to master
6+
push:
7+
branches: [master]
8+
9+
workflow_dispatch:
10+
11+
# Cancel in-progress runs if newer changes to the same branch/PR are pushed.
12+
concurrency:
13+
group: ci-${{ github.head_ref || github.ref }}
14+
cancel-in-progress: true
15+
16+
# Build the game on all platforms and store build artefacts of both jobs
17+
jobs:
18+
meson:
19+
uses: ./.github/workflows/meson.yml
20+
with:
21+
upload_artefacts: true
22+
23+
msbuild:
24+
uses: ./.github/workflows/msbuild.yml
25+
with:
26+
upload_artefacts: true
27+

.github/workflows/meson.yml

Lines changed: 77 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,57 @@
11
name: Meson Build (Linux, macOS)
2-
# Controls when the action will run.
2+
33
on:
4-
# Triggers the workflow on push or pull request events but only for the development branch
5-
push:
6-
branches: [ master, development ]
7-
release:
4+
# Triggers the workflow when manually dispatched
85
workflow_dispatch:
6+
inputs:
7+
upload_artefacts:
8+
description: "Upload build artefacts"
9+
type: boolean
10+
required: false
11+
default: false
12+
build_type:
13+
description: "Build Configuration"
14+
type: choice
15+
required: false
16+
default: "release"
17+
options:
18+
- "release"
19+
- "debug"
20+
debug_level:
21+
description: "Debug Level"
22+
type: choice
23+
required: false
24+
default: "release"
25+
options:
26+
- "release"
27+
- "minimal"
28+
- "full"
29+
30+
# Triggers the workflow when called by a top-level workflow
31+
workflow_call:
32+
inputs:
33+
upload_artefacts:
34+
type: boolean
35+
required: false
36+
default: false
37+
build_type: # "release" | "debug"
38+
type: string
39+
required: false
40+
default: "release"
41+
debug_level: # "full" | "minimal" | "release"
42+
type: string
43+
required: false
44+
default: "release"
45+
46+
env:
47+
MESON_VERSION: "0.60.3"
948

10-
11-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1249
jobs:
13-
# This workflow contains a single job called "build"
14-
build-release-linux:
15-
# The type of runner that the job will run on
16-
runs-on: ubuntu-latest
50+
build-linux:
1751

52+
runs-on: ubuntu-latest
53+
name: Linux Build
1854

19-
# Steps represent a sequence of tasks that will be executed as part of the job
2055
steps:
2156
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2257
- uses: actions/checkout@v3
@@ -26,36 +61,44 @@ jobs:
2661
run: |
2762
sudo apt-get update -yq
2863
sudo apt-get install --no-install-recommends wget liballegro4-dev libloadpng4-dev libflac++-dev luajit-5.1-dev liblua5.2-dev libminizip-dev liblz4-dev libpng++-dev libx11-dev libboost-dev libtbb-dev libsdl2-dev libopengl-dev libfuse2 ninja-build
29-
sudo pip install meson==0.60.0
64+
sudo pip install meson==${{env.MESON_VERSION}}
3065
31-
- name: Install Clang
32-
# You may pin to the exact commit or the version.
33-
# uses: egor-tensin/setup-clang@d16e36d5f8a7eb00aa6627c1a536d94dfc4a913d
34-
uses: egor-tensin/setup-clang@v1
35-
with:
36-
# Set up cc/c++ executables
37-
cc: 1 # optional, default is 1
66+
- name: Setup Meson
67+
env:
68+
CC: "gcc"
69+
CXX: "g++"
70+
run: |
71+
meson setup --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} build
3872
73+
- name: Configure for AppImage
74+
if: ${{inputs.upload_artefacts}}
75+
env:
76+
CC: "gcc"
77+
CXX: "g++"
78+
run: meson configure -Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=/usr/lib/ --prefix=/usr/ build
79+
3980
- name: Build
4081
env:
4182
CC: "gcc"
4283
CXX: "g++"
4384
run: |
44-
meson setup --buildtype=release -Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=/usr/lib/ --prefix=/usr/ build
4585
meson compile -C build
46-
86+
4787
- name: Create AppDir
88+
if: ${{inputs.upload_artefacts}}
4889
run: |
4990
echo "Setting output prefix"
5091
DESTDIR=${GITHUB_WORKSPACE}/build/AppDir meson install -C $GITHUB_WORKSPACE"/build"
5192
5293
- name: Download linuxdeploy
94+
if: ${{inputs.upload_artefacts}}
5395
working-directory: ${{env.GITHUB_WORKSPACE}}
5496
run: |
5597
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O lindeploy
5698
chmod +x lindeploy
5799
58100
- name: Create AppImage
101+
if: ${{inputs.upload_artefacts}}
59102
working-directory: ${{env.GITHUB_WORKSPACE}}
60103
env:
61104
LD_LIBRARY_PATH: ./external/lib/linux/x86_64/
@@ -65,33 +108,40 @@ jobs:
65108
./lindeploy --appdir=build/AppDir --output appimage
66109
67110
- name: Upload Appimage
111+
if: ${{inputs.upload_artefacts}}
68112
uses: actions/upload-artifact@v3
69113
with:
70114
name: CortexCommand (Linux)
71115
path: CortexCommand.AppImage
116+
if-no-files-found: error
72117

73-
build-release-macos:
118+
build-macos:
74119
runs-on: macos-latest
120+
name: MacOS Build
75121

76122
steps:
77123
- uses: actions/checkout@v3
78124
- uses: actions/setup-python@v3
79125

80126
- name: Install Dependencies
81127
run: |
82-
brew install pkg-config tbb sdl2 minizip lz4 flac luajit lua@5.1 libpng gcc ninja meson
83-
128+
brew install pkg-config tbb sdl2 minizip lz4 flac luajit lua@5.1 libpng gcc@12 ninja meson
129+
84130
- name: Build
85131
env:
86132
CC: "gcc-12"
87133
CXX: "g++-12"
88134
LDFLAGS: "-static-libgcc -static-libstdc++"
89135
run: |
90-
meson setup --buildtype=release -Ddebug_type=release build
136+
meson setup --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} build
91137
meson compile -C build
92138
93139
- name: Artifact Deploy
140+
if: ${{inputs.upload_artefacts}}
94141
uses: actions/upload-artifact@v3
95142
with:
96143
name: CortexCommand (macOS)
97-
path: build/CortexCommand
144+
path: |
145+
build/CortexCommand
146+
build/CortexCommand_debug
147+
if-no-files-found: error

0 commit comments

Comments
 (0)