json-schema-validator/.github/workflows/test.yaml
Cristian Le 0f507869c4
Use simplified FetchContent CI
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
2023-05-10 10:40:32 +02:00

63 lines
1.8 KiB
YAML

name: test
run-name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Make it able to be used in other workflows
workflow_call:
jobs:
pre-commit:
name: Check pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/action@v3.0.0
test:
name: Run ctests
needs: [ pre-commit ]
strategy:
matrix:
toolchain: [ gcc, llvm ]
json_version: [ v3.11.2, v3.8.0 ]
env:
NLOHMANN_JSON_VERSION: ${{ matrix.json_version }}
runs-on: ubuntu-latest
container: ghcr.io/nlohmann/json-ci:v2.4.0
steps:
- name: Clone json-schema-validator
uses: actions/checkout@v3
- name: Run CMake ${{ matrix.toolchain }}-ci workflow with nlohmann/json version ${{ matrix.json_version }}
uses: lukka/run-cmake@v10.5
with:
workflowPreset: "${{ matrix.toolchain }}-ci"
coverage:
name: Run coverage tests
needs: [ test ]
runs-on: ubuntu-latest
container: ghcr.io/nlohmann/json-ci:v2.4.0
# TODO: Temporarily disabled because not implemented
if: ${{ false && (github.event_name == 'push' || github.event_name == 'pull_request') }}
steps:
- uses: actions/checkout@v3
- name: Get test coverage
uses: lukka/run-cmake@v10.5
with:
workflowPreset: ci-coverage
- name: Get lcov data
uses: danielealbano/lcov-action@v3
with:
# Note lcov-action prepends and appends wild-cards *. Account for those
# https://github.com/danielealbano/lcov-action/issues/11
remove_patterns: /test/,/cmake-build*/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.info
verbose: true