-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (80 loc) · 2.75 KB
/
Copy pathtest.yml
File metadata and controls
93 lines (80 loc) · 2.75 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
name: test
on:
pull_request:
branches: [ "main" ]
paths:
- '**.c'
- '**.cpp'
- '**.h'
- '**.hpp'
jobs:
format:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
commit_sha: ${{ steps.auto-commit.outputs.commit_hash }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
ref: ${{ github.head_ref }}
persist-credentials: true # commit
- name: Install clang-format
run: sudo apt-get update && sudo apt-get install -y clang-format
- name: Run clang-format
run: clang-format -i $(git ls-files '*.cpp' '*.hpp' '*.h' '*.c')
- name: Commit and push changes
id: auto-commit
if: github.actor != 'github-actions[bot]' && github.event.pull_request.head.repo.full_name == github.repository
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9
build:
needs: format
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Debug, Release]
cpp_compiler: [g++, clang++, cl]
error_mode: [ASSERT, THROW, NONE]
exclude:
- os: ubuntu-latest
cpp_compiler: cl
- build_type: Release
error_mode: ASSERT
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
persist-credentials: false
- name: Set build dir
id: vars
shell: bash
run: echo "dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
shell: bash
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
if [[ "${{ matrix.cpp_compiler }}" == "clang++" ]]; then
SANITIZERS="memory,undefined"
else
SANITIZERS="address,undefined"
fi
fi
cmake -B "${{ steps.vars.outputs.dir }}" \
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DSANITIZERS=${SANITIZERS} \
-DCHESSLIB_ERROR_MODE=${{ matrix.error_mode }} \
-DDART_TESTING_TIMEOUT=0 \
-S "${{ github.workspace }}"
- name: Build
run: cmake --build ${{ steps.vars.outputs.dir }} --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ steps.vars.outputs.dir }}
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
ctest --build-config ${{ matrix.build_type }} --verbose -j 4 --timeout 0
else
ctest --verbose -j 4 --timeout 0
fi