-
-
Notifications
You must be signed in to change notification settings - Fork 162
79 lines (62 loc) · 2.01 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
name: CI
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- { name: Ubuntu, os: ubuntu-latest }
- { name: MacOS, os: macos-latest }
- { name: Windows 64-bit, os: windows-latest, cmake-config: -A x64 }
- { name: Windows 32-bit, os: windows-latest, cmake-config: -A Win32 }
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure project
run: cmake -S . -B build -DBKCRACK_BUILD_TESTING=ON ${{ matrix.platform.cmake-config }}
- name: Build project
run: cmake --build build --config Release
- name: Run tests
run: ctest --test-dir build -C Release --output-on-failure
- name: Create package
run: cmake --build build --config Release --target package
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.name }} package
path: |
build/*.zip
build/*.tar.gz
format:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure project
run: cmake -S . -B build -DBKCRACK_CLANG_FORMAT_EXECUTABLE=/usr/bin/clang-format-15
- name: Format C++ code
run: cmake --build build --target format
- name: Check for difference
run: git diff --exit-code
release:
name: Release
runs-on: ubuntu-latest
needs: [build, format]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
pattern: "* package"
path: packages
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
files: packages/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}