From 040ed864bad1f8fc0ccacef8f335542d60879a43 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 9 May 2023 17:26:12 +0200 Subject: [PATCH] Simplify action CIs Signed-off-by: Cristian Le --- .github/workflows/test.yaml | 59 ++++++++++--------------------------- 1 file changed, 16 insertions(+), 43 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8e0fa47..f67f74c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,21 +18,25 @@ jobs: - uses: actions/setup-python@v4 - uses: pre-commit/action@v3.0.0 - build_and_test: - name: Check pre-commit + 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 - needs: [ pre-commit ] steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub." - - run: echo "🔎 Branch name is ${{ github.ref }} and repository is ${{ github.repository }}." - - name: Clone nlohmann json - uses: actions/checkout@master + - name: Clone nlohmann json version ${{ matrix.json_version }} + uses: actions/checkout@v3 with: repository: nlohmann/json path: nlohmann-json - ref: v3.11.2 + ref: ${{ matrix.json_version }} + # TODO: Move to FetchContent managed - name: Build and install nlohmann json run: | cd nlohmann-json @@ -41,38 +45,7 @@ jobs: cd .. - name: Clone json-schema-validator uses: actions/checkout@v3 - - name: cmake - run: cmake -S . -B build - - name: build - run: cmake --build build --target all -j$(nproc) - - name: test - run: cd build && ctest - build_and_test_min_version: - name: Check pre-commit - runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.4.0 - needs: [ pre-commit ] - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub." - - run: echo "🔎 Branch name is ${{ github.ref }} and repository is ${{ github.repository }}." - - name: Clone nlohmann json - uses: actions/checkout@master + - name: Run CMake ${{ matrix.toolchain }}-ci workflow with nlohmann/json version ${{ matrix.json_version }} + uses: lukka/run-cmake@v10.5 with: - repository: nlohmann/json - path: nlohmann-json - ref: v3.8.0 - - name: Build and install nlohmann json - run: | - cd nlohmann-json - cmake -S . -B build - cmake --build build --target install -j$(nproc) - cd .. - - name: Clone json-schema-validator - uses: actions/checkout@v3 - - name: cmake - run: cmake -S . -B build - - name: build - run: cmake --build build --target all -j$(nproc) - - name: test - run: cd build && ctest + workflowPreset: "${{ matrix.toolchain }}-ci"