-
Notifications
You must be signed in to change notification settings - Fork 5
105 lines (91 loc) · 3.17 KB
/
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
name: CI
on:
push:
paths-ignore:
- .gitignore
- README.md
- svenbxt.cfg
pull_request:
paths-ignore:
- .gitignore
- README.md
- svenbxt.cfg
workflow_dispatch:
schedule:
- cron: '0 0 1 * *' # Monthly
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest]
build_type: [Release]
c_compiler: [gcc, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
artifact: "svenbxt_windows-cl"
bin-path: "src/build/Release/SvenBXT.dll"
toolchain-file: ""
cmake-generator: "Visual Studio 17 2022"
build-target: "-A Win32"
- os: ubuntu-20.04
c_compiler: gcc
cpp_compiler: g++
artifact: "svenbxt_ubuntu-gcc"
bin-path: "src/build/libSvenBXT.so"
toolchain-file: "cmake/ToolchainLinuxGCC.cmake"
cmake-generator: "Unix Makefiles"
build-target: ""
exclude:
- os: windows-latest
c_compiler: gcc
- os: ubuntu-20.04
c_compiler: cl
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout submodules
shell: bash
run: git submodule update --init --recursive
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/src/build" >> "$GITHUB_OUTPUT"
echo "src-dir=${{ github.workspace }}/src" >> "$GITHUB_OUTPUT"
- name: Add MSBuild to PATH
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Install Ubuntu packages
if: runner.os == 'Linux'
run: |
sudo dpkg --add-architecture i386
sudo apt update || true
sudo apt install -y build-essential libc6:i386 g++-multilib mesa-common-dev libgl-dev:i386 libgl1-mesa-dev
- name: Configure CMake
run: >
cmake -G "${{ matrix.cmake-generator }}"
${{ matrix.build-target }}
-B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain-file }}
-DFUNCHOOK_BUILD_TESTS=OFF
-S ${{ steps.strings.outputs.src-dir }}
- name: Build Linux version
if: runner.os == 'Linux'
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Build Windows version
if: runner.os == 'Windows'
run: msbuild /m /p:OutputPath=${{ steps.strings.outputs.build-output-dir }} /p:Configuration=${{ matrix.build_type }} ${{ steps.strings.outputs.build-output-dir }}/SvenBXT.sln
- name: Prepare artifacts
run: mkdir -p bin && mv ${{ matrix.bin-path }} bin/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
path: ./bin
name: ${{ matrix.artifact }}