-
Notifications
You must be signed in to change notification settings - Fork 29
139 lines (118 loc) · 3.89 KB
/
ci.yml
File metadata and controls
139 lines (118 loc) · 3.89 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
jobs:
linux:
name: Linux x64 (${{ matrix.compiler.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler:
- { name: GCC, cc: gcc, cxx: g++, artifact: sqfvm_linux_x64_gcc, cxxflags: "-Wno-changes-meaning" }
- { name: Clang, cc: clang, cxx: clang++, artifact: sqfvm_linux_x64_clang, cxxflags: "" }
steps:
- uses: actions/checkout@v4
- name: Build
run: |
cmake -B build
cmake --build build --parallel $(nproc)
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
CXXFLAGS: ${{ matrix.compiler.cxxflags }}
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.compiler.artifact }}
path: build/sqfvm*
- name: Run SQF-VM Tests
working-directory: build
run: ctest --output-on-failure
- name: Run CBA A3 Tests
run: PATH=build:$PATH python tests/cba/cba_a3.py
macos:
name: macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: |
cmake -B build
cmake --build build --parallel $(sysctl -n hw.ncpu)
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: sqfvm_macos
path: build/sqfvm*
- name: Run SQF-VM Tests
working-directory: build
run: ctest --output-on-failure
- name: Run CBA A3 Tests
run: PATH=build:$PATH python tests/cba/cba_a3.py
windows:
name: Windows ${{ matrix.arch }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- { arch: Win32, cmake_arch: Win32, artifact: sqfvm_windows_win32 }
- { arch: x64, cmake_arch: x64, artifact: sqfvm_windows_x64 }
steps:
- uses: actions/checkout@v4
- name: Build
run: |
cmake -B build -A ${{ matrix.cmake_arch }}
cmake --build build --config Release --parallel $env:NUMBER_OF_PROCESSORS
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: build/Release/*.exe
- name: Run SQF-VM Tests
working-directory: build
run: ctest --output-on-failure -C Release
- name: Run CBA A3 Tests
run: |
$env:Path += ";build/Release/"
python tests/cba/cba_a3.py
# ── Release ────────────────────────────────────────────────────────
# Only runs on push-to-master (not PRs, not workflow_dispatch).
# Waits for every CI job to pass before publishing.
release:
name: Publish Release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [linux, macos, windows]
runs-on: ubuntu-latest
permissions:
contents: write # required to create releases & tags
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Package artifacts
run: |
cd artifacts
for dir in */; do
name="${dir%/}"
zip -r "../${name}.zip" "$dir"
done
- name: Generate release tag
id: tag
run: |
TAG="v$(date -u +'%Y.%m.%d')-${GITHUB_SHA::7}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "Generated tag: $TAG"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: Build ${{ steps.tag.outputs.tag }}
generate_release_notes: true
files: "*.zip"