From aa84673a3310554e0fbff478897391261cefbe0a Mon Sep 17 00:00:00 2001 From: Matheus Castello Date: Wed, 15 Jan 2025 15:23:49 -0300 Subject: [PATCH] github: workflow: Use reusable workflow for all CI jobs To make the workflow dependency chain, the best approach is to use the reusable workflow feature. Signed-off-by: Matheus Castello --- .github/workflows/build-and-publish.yaml | 47 ++++++++++++++++++++ .github/workflows/build-ccpp.yaml | 6 +-- .github/workflows/build-debug-ccpp.yaml | 6 +-- .github/workflows/build-debug-python.yaml | 6 +-- .github/workflows/build-debug-rust.yaml | 6 +-- .github/workflows/build-python.yaml | 6 +-- .github/workflows/build-rust.yaml | 6 +-- .github/workflows/ci-tests.yaml | 8 +--- .github/workflows/publish-torizon-utils.yaml | 16 ++----- 9 files changed, 64 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/build-and-publish.yaml diff --git a/.github/workflows/build-and-publish.yaml b/.github/workflows/build-and-publish.yaml new file mode 100644 index 00000000..fc9c4722 --- /dev/null +++ b/.github/workflows/build-and-publish.yaml @@ -0,0 +1,47 @@ +name: Build and Publish +on: + push: + branches: + - dev + pull_request: + branches: + - dev + +jobs: + sanity-check: + uses: ./.github/workflows/ci-tests.yaml + + build-ccpp: + uses: ./.github/workflows/build-ccpp.yaml + needs: sanity-check + + build-debug-ccpp: + uses: ./.github/workflows/build-debug-ccpp.yaml + needs: sanity-check + + build-debug-python: + uses: ./.github/workflows/build-debug-python.yaml + needs: sanity-check + + build-python: + uses: ./.github/workflows/build-python.yaml + needs: sanity-check + + build-debug-rust: + uses: ./.github/workflows/build-debug-rust.yaml + needs: sanity-check + + build-rust: + uses: ./.github/workflows/build-rust.yaml + needs: sanity-check + + + publish-torizon-utils: + uses: ./.github/workflows/publish-torizon-utils.yaml + needs: + - build-ccpp + - build-debug-ccpp + - build-debug-python + - build-python + - build-debug-rust + - build-rust diff --git a/.github/workflows/build-ccpp.yaml b/.github/workflows/build-ccpp.yaml index b6d15df2..39d7c451 100644 --- a/.github/workflows/build-ccpp.yaml +++ b/.github/workflows/build-ccpp.yaml @@ -1,9 +1,7 @@ name: C/C++ Containers on: - push: - branches: - - dev - - bookworm + workflow_call: + secrets: inherit jobs: ccpp: diff --git a/.github/workflows/build-debug-ccpp.yaml b/.github/workflows/build-debug-ccpp.yaml index 8aecad8a..edab2915 100644 --- a/.github/workflows/build-debug-ccpp.yaml +++ b/.github/workflows/build-debug-ccpp.yaml @@ -1,9 +1,7 @@ name: C/C++ Debug Containers on: - push: - branches: - - dev - - bookworm + workflow_call: + secrets: inherit jobs: ccpp-debug: diff --git a/.github/workflows/build-debug-python.yaml b/.github/workflows/build-debug-python.yaml index 4cbefbe8..1b3b200b 100644 --- a/.github/workflows/build-debug-python.yaml +++ b/.github/workflows/build-debug-python.yaml @@ -1,9 +1,7 @@ name: Python Debug Containers on: - push: - branches: - - dev - - bookworm + workflow_call: + secrets: inherit jobs: python3-debug: diff --git a/.github/workflows/build-debug-rust.yaml b/.github/workflows/build-debug-rust.yaml index 415345a5..4d608701 100644 --- a/.github/workflows/build-debug-rust.yaml +++ b/.github/workflows/build-debug-rust.yaml @@ -1,9 +1,7 @@ name: Rust Debug Containers on: - push: - branches: - - dev - - bookworm + workflow_call: + secrets: inherit jobs: rust-debug: diff --git a/.github/workflows/build-python.yaml b/.github/workflows/build-python.yaml index 4e241209..751fdf2b 100644 --- a/.github/workflows/build-python.yaml +++ b/.github/workflows/build-python.yaml @@ -1,9 +1,7 @@ name: Python Containers on: - push: - branches: - - dev - - bookworm + workflow_call: + secrets: inherit jobs: python3: diff --git a/.github/workflows/build-rust.yaml b/.github/workflows/build-rust.yaml index 932c50be..cc71ab31 100644 --- a/.github/workflows/build-rust.yaml +++ b/.github/workflows/build-rust.yaml @@ -1,9 +1,7 @@ name: Rust Containers on: - push: - branches: - - dev - - bookworm + workflow_call: + secrets: inherit jobs: rust: diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yaml index baafd790..64bdba7b 100644 --- a/.github/workflows/ci-tests.yaml +++ b/.github/workflows/ci-tests.yaml @@ -1,11 +1,7 @@ name: Sanity Check on: - push: - branches: - - dev - pull_request: - branches: - - dev + workflow_call: + secrets: inherit jobs: spell-check: diff --git a/.github/workflows/publish-torizon-utils.yaml b/.github/workflows/publish-torizon-utils.yaml index bc880dfd..0b6072cd 100644 --- a/.github/workflows/publish-torizon-utils.yaml +++ b/.github/workflows/publish-torizon-utils.yaml @@ -1,22 +1,12 @@ name: Publish Torizon Utils - on: - workflow_run: - workflows: - - "Sanity Check" - - "C\\/C\\+\\+ Containers" - - "C\\/C\\+\\+ Debug Containers" - - "Python Debug Containers" - - "Rust Debug Containers" - - "Python Containers" - - "Rust Containers" - types: - - completed + workflow_call: + secrets: inherit jobs: publish: - if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v3