From 759c94fe8a48debfa981204a99b9d26ed02b2fe8 Mon Sep 17 00:00:00 2001 From: Joerg Herbel Date: Wed, 8 Nov 2023 16:58:07 +0100 Subject: [PATCH] Implement CI workflow with check_success job which must always be green CMK-15099 --- .github/workflows/ci.yaml | 58 ++++++++++++++++++++++++++++ .github/workflows/rcc.yaml | 6 --- .github/workflows/release.yaml | 14 +++---- .github/workflows/robotmk_build.yaml | 6 --- .github/workflows/tests.yaml | 3 +- 5 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..bf392dc5 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,58 @@ +--- +name: "CI" + +on: + push: + branches: + # Do not trigger on tags + # https://stackoverflow.com/questions/68573888/how-can-i-not-execute-a-github-action-when-i-push-a-new-tag + "**" + pull_request: + +jobs: + analyse_changes: + if: always() + runs-on: ubuntu-latest + outputs: + robotmk_yaml_changed: ${{ steps.filter.outputs.robotmk_yaml }} + rcc_yaml_changed: ${{ steps.filter.outputs.rcc_yaml }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + robotmk_yaml: + - '.github/workflows/robotmk.yaml' + rcc_yaml: + - '.github/workflows/rcc.yaml' + + tests: + if: always() + uses: ./.github/workflows/tests.yaml + + build_robotmk: + needs: + - analyse_changes + if: ${{ needs.analyse_changes.outputs.robotmk_yaml_changed == 'true' }} + uses: ./.github/workflows/robotmk_build.yaml + + rcc: + needs: + - analyse_changes + if: ${{ needs.analyse_changes.outputs.rcc_yaml_changed == 'true' }} + uses: ./.github/workflows/rcc.yaml + + check_success: + if: always() + runs-on: Ubuntu-latest + needs: + - tests + - build_robotmk + - rcc + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + allowed-skips: build_robotmk, rcc + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/rcc.yaml b/.github/workflows/rcc.yaml index 9d8ec6f4..5ccae8c9 100644 --- a/.github/workflows/rcc.yaml +++ b/.github/workflows/rcc.yaml @@ -2,12 +2,6 @@ name: "RCC" on: - push: - paths: - - .github/workflows/rcc.yaml - pull_request: - paths: - - .github/workflows/rcc.yaml workflow_call: {} jobs: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9f4e92e2..a8ccd7e6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,18 +1,14 @@ --- name: "Upload all artifacts" + on: push: - paths: - - .github/workflows/release.yaml - - .github/workflows/rcc.yaml - - .github/workflows/robotmk.yaml - pull_request: - paths: - - .github/workflows/release.yaml - - .github/workflows/rcc.yaml - - .github/workflows/robotmk.yaml + tags: + "**" jobs: + tests: + uses: ./.github/workflows/tests.yaml build_rcc: uses: ./.github/workflows/rcc.yaml build_robotmk: diff --git a/.github/workflows/robotmk_build.yaml b/.github/workflows/robotmk_build.yaml index 20a03619..98dc9c4c 100644 --- a/.github/workflows/robotmk_build.yaml +++ b/.github/workflows/robotmk_build.yaml @@ -2,12 +2,6 @@ name: "Build Robotmk" on: - push: - paths: - - .github/workflows/robotmk.yaml - pull_request: - paths: - - .github/workflows/robotmk.yaml workflow_call: {} jobs: diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 8078ba43..df69a981 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,6 +1,7 @@ name: "Tests" -on: [push, pull_request] +on: + workflow_call: {} jobs: ci: