1# This is a format job. Pre-commit has a first-party GitHub action, so we use
2# that: https://github.com/pre-commit/action
3
4name: Format
5
6on:
7  workflow_dispatch:
8  pull_request:
9  push:
10    branches:
11    - master
12    - stable
13    - "v*"
14
15jobs:
16  pre-commit:
17    name: Format
18    runs-on: ubuntu-latest
19    steps:
20    - uses: actions/checkout@v2
21    - uses: actions/setup-python@v2
22    - uses: pre-commit/action@v2.0.0
23      with:
24        # Slow hooks are marked with manual - slow is okay here, run them too
25        extra_args: --hook-stage manual --all-files
26
27  clang-tidy:
28    name: Clang-Tidy
29    runs-on: ubuntu-latest
30    container: silkeh/clang:10
31    steps:
32    - uses: actions/checkout@v2
33
34    - name: Install requirements
35      run: apt-get update && apt-get install -y python3-dev python3-pytest
36
37    - name: Configure
38      run: >
39        cmake -S . -B build
40        -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--warnings-as-errors=*"
41        -DDOWNLOAD_EIGEN=ON
42        -DDOWNLOAD_CATCH=ON
43        -DCMAKE_CXX_STANDARD=17
44
45    - name: Build
46      run: cmake --build build -j 2
47