-
Notifications
You must be signed in to change notification settings - Fork 44
112 lines (106 loc) · 3.86 KB
/
workflow.yaml
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
106
107
108
109
110
111
112
name: Workflow
on:
push:
branches:
- 'main'
- 'ci-*'
tags:
- 'v*'
pull_request:
jobs:
ci:
strategy:
matrix:
platform:
- { name: 'Linux', arch: 'x64', os: ubuntu-latest, werror: true }
- { name: 'Linux', arch: 'arm64', os: ubuntu-latest, werror: true, cmake-toolchain-file: 'cmake/toolchains/linux-aarch64.cmake', apt-packages: 'gcc-aarch64-linux-gnu g++-aarch64-linux-gnu', cross: true }
- { name: 'MacOS', arch: 'arm64-x64', os: macos-latest, werror: true, cmake-args: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
- { name: 'Windows', arch: 'x86', os: windows-latest, msvc-arch: 'Win32' }
- { name: 'Windows', arch: 'x64', os: windows-latest, msvc-arch: 'x64' }
# - { name: 'Windows', arch: 'arm64', os: windows-latest, msvc-arch: 'amd64_arm64', cross: true }
defaults:
run:
shell: sh
runs-on: '${{ matrix.platform.os }}'
name: 'CI ${{ matrix.platform.name }} ${{ matrix.platform.arch }}'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Ninja
uses: aseprite/get-ninja@main
- uses: ilammy/msvc-dev-cmd@v1.13.0
if: ${{ !!matrix.platform.msvc-arch }}
with:
arch: ${{ matrix.platform.msvc-arch }}
- name: Install Linux dependencies
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install -y libgl-dev ${{ matrix.platform.apt-packages }}
- name: Set up SDL
uses: libsdl-org/setup-sdl@main
with:
cmake-arguments: ${{ matrix.platform.cmake-args }}
cmake-generator: Ninja
cmake-toolchain-file: ${{ matrix.platform.cmake-toolchain-file }}
version: 2-latest
add-to-environment: true
- name: 'Prepare sources for release'
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
echo "${{ github.ref_name }}" >VERSION
- name: 'Configure (CMake)'
id: configure
run: |
cmake -B build -GNinja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTS=ON \
-DDETHRACE_WERROR=${{ !!matrix.platform.werror }} \
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW \
-DDETHRACE_INSTALL=ON \
-DDETHRACE_PACKAGE_PLATFORM=${{ matrix.platform.name }} \
-DDETHRACE_PACKAGE_ARCH=${{ matrix.platform.arch }} \
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.platform.cmake-toolchain-file }} \
${{ matrix.platform.cmake-args }}
- name: 'Build (CMake)'
run: |
cmake --build build
- name: 'Test (CTest)'
if: ${{ !matrix.platform.cross }}
run: |
ctest --test-dir build --verbose
- name: 'Package (CPack)'
run: |
cd build
cpack .
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: '${{ steps.configure.outputs.filename }}'
path: 'build/dist/${{ steps.configure.outputs.filename }}'
if-no-files-found: error
create-release:
name: Create Release
needs: [ci]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Fetch Build Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Calculate Variables
id: vars
run: |
echo "ref_name_without_v=$(echo ${GITHUB_REF_NAME} | cut -c2-)" >>$GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: false
name: Dethrace ${{ steps.vars.outputs.ref_name_without_v }}
generate_release_notes: true
files: |
artifacts/**