Split up the test pipeline for faster test runs (#471)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-07-30 23:03:47 +02:00
committed by GitHub
parent c5f0a241c7
commit 07cf980a00
8 changed files with 141 additions and 87 deletions
+43 -40
View File
@@ -10,36 +10,41 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- compiler: llvm
format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML", "benchmarks"]
compiler: [llvm, gcc]
compiler-version: [11, 12, 13, 14, 16, 17, 18]
cxx: [20, 23]
exclude:
- compiler: gcc
compiler-version: 16
cxx: 20
- compiler: llvm
- compiler: gcc
compiler-version: 17
cxx: 20
- compiler: llvm
- compiler: gcc
compiler-version: 18
cxx: 20
- compiler: llvm
compiler-version: 11
- compiler: llvm
compiler-version: 12
- compiler: llvm
compiler-version: 13
- compiler: llvm
compiler-version: 14
- compiler: gcc
compiler-version: 11
additional-dep: "g++-11"
cxx: 20
- compiler: gcc
compiler-version: 12
cxx: 20
- compiler: gcc
compiler-version: 13
cxx: 20
- compiler: gcc
compiler-version: 14
cxx: 20
- compiler: gcc
compiler-version: 13
cxx: 23
- compiler: gcc
compiler-version: 14
compiler-version: 12
cxx: 23
name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }})"
- compiler: gcc
compiler-version: 13
cxx: 23
- compiler: llvm
compiler-version: 16
cxx: 23
- compiler: llvm
compiler-version: 17
cxx: 23
name: "${{ github.job }} (${{ matrix.format }}-C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }})"
runs-on: ubuntu-24.04
steps:
- name: Checkout
@@ -53,24 +58,16 @@ jobs:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: "${{ github.job }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}"
max-size: "2G"
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y ninja-build ${{ matrix.additional-dep }}
- name: Install Conan
run: |
sudo apt install -y pipx
pipx install conan
conan profile detect
- name: Make sure the library compiles with Conan
run: conan build . --build=missing -s compiler.cppstd=gnu20 -o *:with_capnproto=True -o *:with_cbor=True -o *:with_flatbuffers=True -o *:with_msgpack=True -o *:with_toml=True -o *:with_ubjson=True -o *:with_xml=True -o *:with_yaml=True
if [[ "${{ matrix.compiler-version }}" == 11 ]]; then
sudo apt install -y ninja-build g++-11
else
sudo apt install -y ninja-build
fi
- name: Compile
run: |
if [[ "${{ matrix.compiler }}" == "llvm" ]]; then
@@ -80,15 +77,21 @@ jobs:
export CC=gcc-${{ matrix.compiler-version }}
export CXX=g++-${{ matrix.compiler-version }}
fi
sudo ln -s $(which ccache) /usr/local/bin/$CC
sudo ln -s $(which ccache) /usr/local/bin/$CXX
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CAPNPROTO=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build
if [[ "${{ matrix.format }}" == "JSON" ]]; then
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release
elif [[ "${{ matrix.format }}" == "benchmarks" ]]; then
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_ALL_FORMATS=ON -DCMAKE_BUILD_TYPE=Release
else
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release
fi
cmake --build build -j4
- name: Run tests
if: matrix.format != 'benchmarks'
run: |
ctest --test-dir build --output-on-failure
- name: Run benchmarks
- name: Run benchmarks
if: matrix.format == 'benchmarks'
run: |
echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY
echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY