Optimize ci #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
code-style: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install clang-format-17 | |
run: | | |
sudo apt-get remove clang-format* | |
sudo apt-get autoremove | |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc | |
echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee -a /etc/apt/sources.list | |
echo "deb-src https://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee -a /etc/apt/sources.list | |
sudo apt-get update | |
sudo apt-get install clang-format-17 | |
sudo ln -s -f /usr/bin/clang-format-17 /usr/bin/clang-format | |
clang-format --version | |
- name: Check code style | |
run: | | |
cmake -B build . | |
cmake --build build -- check-format | |
windows: | |
needs: code-style | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
arch: | |
- amd64 | |
- x86 | |
- amd64_arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{ matrix.arch }} | |
- name: Build | |
shell: cmd | |
run: | | |
cmake -GNinja -B build . | |
cmake --build build -- all | |
- name: Test | |
if: ${{ matrix.arch != 'amd64_arm64' }} | |
shell: cmd | |
run: | | |
cmake --build build -- check | |
macos: | |
needs: code-style | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
arch: | |
- x86_64 | |
- arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Build | |
run: | | |
cmake -DCMAKE_OSX_ARCHITECTURES=${{matrix.arch}} -B build . | |
cmake --build build -- all | |
- name: Test | |
if: ${{ matrix.arch != 'arm64' }} | |
run: | | |
cmake --build build -- check | |
linux: | |
needs: code-style | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Build | |
run: | | |
cmake -B build . | |
cmake --build build -- all | |
- name: Test | |
run: | | |
cmake --build build -- check |