-
Notifications
You must be signed in to change notification settings - Fork 30
164 lines (155 loc) · 5.71 KB
/
cmake.yml
File metadata and controls
164 lines (155 loc) · 5.71 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: CMake
on:
push:
branches: [ main ]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || 'main' }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
build_number: ${{ steps.get-build-number.outputs.build_number }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: clang-format Check
shell: bash
run: find . -iname '*.hh' -o -iname '*.cc' -o -iname '*.ixx' | xargs clang-format-18 --dry-run -Werror
- name: Get Build Number
id: get-build-number
shell: bash
run: |
NEXT_BUILD=$(gh release list --json name,isLatest --jq '.[] | select(.isLatest)|.name | ltrimstr("b") | tonumber + 1 | "b" + tostring')
NEXT_BUILD=${NEXT_BUILD:-"b1"}
echo "build_number=$NEXT_BUILD" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-windows:
needs: check
strategy:
matrix:
include:
- arch: x86
platform: Win32
- arch: x64
platform: x64
- arch: arm64
platform: ARM64
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v6
- name: CMake Configure
run: cmake -B ${{github.workspace}}/BUILD -G "Visual Studio 17 2022" -A ${{matrix.platform}} -DCMAKE_BUILD_TYPE=Release -DREDUMPER_VERSION_BUILD=${{needs.check.outputs.build_number}} -DCMAKE_TOOLCHAIN_FILE="cmake/toolchains/windows-${{matrix.arch}}.cmake"
- name: CMake Build
run: cmake --build ${{github.workspace}}/BUILD --config Release
- name: CTest
if: ${{ matrix.arch != 'arm64' }}
working-directory: ${{github.workspace}}/BUILD
run: ctest -C Release --output-on-failure --verbose
- name: CPack
working-directory: ${{github.workspace}}/BUILD
run: cpack -G ZIP --config CPackConfig.cmake
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: windows_${{matrix.arch}}
path: ${{github.workspace}}/BUILD/redumper-*.zip
build-linux:
needs: check
strategy:
matrix:
include:
- arch: x86
os: ubuntu-24.04
- arch: x64
os: ubuntu-24.04
- arch: arm64
os: ubuntu-24.04-arm
runs-on: ${{matrix.os}}
steps:
- name: Customize Software
if: ${{ matrix.arch == 'x86' }}
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install clang-18 lld-18 clang-tools-18 clang-format-18 ninja-build libc6-dev-i386 libstdc++-13-dev:i386 libc++-18-dev:i386
- name: Customize Software
if: ${{ matrix.arch != 'x86' }}
run: sudo apt-get install clang-18 lld-18 clang-tools-18 clang-format-18 libc++-18-dev ninja-build
- name: Checkout
uses: actions/checkout@v6
- name: CMake Configure
run: cmake -B ${{github.workspace}}/BUILD -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DREDUMPER_VERSION_BUILD=${{needs.check.outputs.build_number}} -DCMAKE_TOOLCHAIN_FILE="cmake/toolchains/linux-${{matrix.arch}}.cmake"
- name: CMake Build
run: cmake --build ${{github.workspace}}/BUILD --config Release
- name: CTest
working-directory: ${{github.workspace}}/BUILD
run: ctest -C Release --output-on-failure --verbose
- name: CPack
working-directory: ${{github.workspace}}/BUILD
run: cpack -G ZIP --config CPackConfig.cmake
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: linux_${{matrix.arch}}
path: ${{github.workspace}}/BUILD/redumper-*.zip
build-macos:
needs: check
strategy:
matrix:
arch: [x64, arm64]
runs-on: macos-14
steps:
- name: Customize Software
run: |
brew install llvm@18
- name: Customize Software
if: ${{ matrix.arch == 'x64' }}
run: |
softwareupdate --install-rosetta --agree-to-license
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install llvm@18
- name: Checkout
uses: actions/checkout@v6
- name: CMake Configure
run: cmake -B ${{github.workspace}}/BUILD -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DREDUMPER_VERSION_BUILD=${{needs.check.outputs.build_number}} -DCMAKE_TOOLCHAIN_FILE="cmake/toolchains/macos-${{matrix.arch}}.cmake"
- name: CMake Build
run: cmake --build ${{github.workspace}}/BUILD --config Release
- name: CTest
working-directory: ${{github.workspace}}/BUILD
run: ctest -C Release --output-on-failure --verbose
- name: CPack
working-directory: ${{github.workspace}}/BUILD
run: cpack -G ZIP --config CPackConfig.cmake
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: macos_${{matrix.arch}}
path: ${{github.workspace}}/BUILD/redumper-*.zip
release:
if: github.event_name != 'pull_request'
needs: [check, build-windows, build-linux, build-macos]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download Artifact
uses: actions/download-artifact@v8
with:
merge-multiple: true
- name: 'Create Release'
shell: bash
run: |
shopt -s nullglob
files=(redumper-*.zip)
if [ ${#files[@]} -eq 0 ]; then
echo "No artifacts to release"; exit 1
fi
gh release create --generate-notes "${{needs.check.outputs.build_number}}" "${files[@]}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}