From 6a077ce610c547a0f44907a9788dbf5ddb795e00 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 9 May 2023 11:40:14 +0200 Subject: [PATCH] Reconfigure github action - Enforce pre-commits - Move conan to CD workflow Signed-off-by: Cristian Le --- .github/workflows/release.yaml | 31 +++++++++++++ .../{github-actions.yml => test.yaml} | 45 +++++++++---------- 2 files changed, 51 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/release.yaml rename .github/workflows/{github-actions.yml => test.yaml} (72%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..8897a61 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,31 @@ +name: release +run-name: Release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" + +jobs: + tests: + uses: ./.github/workflows/test.yaml + secrets: inherit + + build_conan: + runs-on: ubuntu-latest + container: ghcr.io/nlohmann/json-ci:v2.4.0 + 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 json-schema-validator + uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - run: python -m pip install --upgrade conan + - run: conan config init + - run: conan profile update settings.compiler.libcxx=libstdc++11 default + - name: conan create package + run: conan create . diff --git a/.github/workflows/github-actions.yml b/.github/workflows/test.yaml similarity index 72% rename from .github/workflows/github-actions.yml rename to .github/workflows/test.yaml index d5d5c42..8e0fa47 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/test.yaml @@ -1,18 +1,28 @@ -name: Ubuntu +name: test +run-name: Tests on: push: - branches: - - develop - - master - - release/* - - main + 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 + build_and_test: + 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." @@ -30,7 +40,7 @@ jobs: cmake --build build --target install -j$(nproc) cd .. - name: Clone json-schema-validator - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: cmake run: cmake -S . -B build - name: build @@ -38,8 +48,10 @@ jobs: - 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." @@ -57,27 +69,10 @@ jobs: cmake --build build --target install -j$(nproc) cd .. - name: Clone json-schema-validator - uses: actions/checkout@v2 + 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_conan: - runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.4.0 - 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 json-schema-validator - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - run: python -m pip install --upgrade conan - - run: conan config init - - run: conan profile update settings.compiler.libcxx=libstdc++11 default - - name: conan create package - run: conan create .