Skip to content

fix CI workflow

fix CI workflow #32

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Run linting
run: nix-shell --run "cmake -D FORMAT_COMMAND=clang-format -P cmake/lint.cmake" shell.nix
- name: Spell check
if: always()
run: nix-shell --run "cmake -P cmake/spell.cmake" shell.nix
coverage:
needs: [lint]
runs-on: ubuntu-24.04
if: github.repository_owner == '<name>' && false
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Configure
run: nix-shell --run "cmake --preset=ci-coverage" shell.nix
- name: Build
run: nix-shell --run "cmake --build build/coverage -j 2" shell.nix
- name: Test
working-directory: build/coverage
run: nix-shell --run "ctest --output-on-failure --no-tests=error -j 2" shell.nix
- name: Process coverage info
run: nix-shell --run "cmake --build build/coverage -t coverage" shell.nix
- name: Submit to codecov.io
uses: codecov/codecov-action@v4
with:
file: build/coverage/coverage.info
token: ${{ secrets.CODECOV_TOKEN }}
sanitize:
needs: [lint]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Configure
run: nix-shell --run "cmake --preset=ci-sanitize" shell.nix
- name: Build
run: nix-shell --run "cmake --build build/sanitize -j 2" shell.nix
- name: Test
working-directory: build/sanitize
run: nix-shell --run 'ASAN_OPTIONS="strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_leaks=1:halt_on_error=1" UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1" ctest --output-on-failure --no-tests=error -j 2' "$GITHUB_WORKSPACE/shell.nix"
test:
needs: [lint]
strategy:
matrix:
os: [ubuntu-24.04]
type: [shared, static]
include:
- { type: shared, shared: YES }
- { type: static, shared: NO }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Extract OS name
id: os-name
run: |
OS_SHORT=$(echo "${{ matrix.os }}" | cut -d'-' -f1)
echo "os_short=$OS_SHORT" >> $GITHUB_OUTPUT
- name: Configure
run: nix-shell --run "cmake --preset=ci-${{ steps.os-name.outputs.os_short }} -D BUILD_SHARED_LIBS=${{ matrix.shared }}" shell.nix
- name: Build
run: nix-shell --run "cmake --build build --config Release -j 2" shell.nix
- name: Install
run: nix-shell --run "cmake --install build --config Release --prefix prefix" shell.nix
- name: Test
working-directory: build
run: nix-shell --run "ctest --output-on-failure --no-tests=error -C Release -j 2" "$GITHUB_WORKSPACE/shell.nix"