77 lines
2.0 KiB
YAML
77 lines
2.0 KiB
YAML
name: '🧪 Test'
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- develop
|
|
paths-ignore:
|
|
- '**/*.md'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- develop
|
|
paths-ignore:
|
|
- '**/*.md'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: linux/amd64
|
|
container:
|
|
image: gitea.tourolle.paris/dtourolle/kpnpp-builder:latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: test-${{ github.run_id }}
|
|
|
|
- name: Cache FetchContent dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cmake/fetchcontent
|
|
key: cmake-fetchcontent-${{ hashFiles('**/CMakeLists.txt') }}
|
|
restore-keys: cmake-fetchcontent-
|
|
|
|
- name: Configure
|
|
working-directory: test-${{ github.run_id }}
|
|
run: |
|
|
cmake -S . -B build \
|
|
-G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
-DKPN_BUILD_TESTS=ON \
|
|
-DKPN_BUILD_EXAMPLES=ON \
|
|
-DKPN_BUILD_PYTHON=ON \
|
|
-DFETCHCONTENT_BASE_DIR=$HOME/.cmake/fetchcontent
|
|
|
|
- name: Build
|
|
working-directory: test-${{ github.run_id }}
|
|
run: cmake --build build --parallel
|
|
|
|
- name: Run unit tests
|
|
working-directory: test-${{ github.run_id }}
|
|
run: |
|
|
cd build
|
|
ctest --output-on-failure --output-junit test-results.xml --label-exclude examples
|
|
|
|
- name: Run example smoke tests
|
|
working-directory: test-${{ github.run_id }}
|
|
run: |
|
|
cd build
|
|
ctest --output-on-failure --output-junit example-results.xml -L examples
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: test-results
|
|
path: |
|
|
test-${{ github.run_id }}/build/test-results.xml
|
|
test-${{ github.run_id }}/build/example-results.xml
|
|
retention-days: 7
|
|
|
|
- name: Cleanup
|
|
if: always()
|
|
run: rm -rf test-${{ github.run_id }}
|