Skip to content

Commit

Permalink
github: workflow: Use reusable workflow for all CI jobs
Browse files Browse the repository at this point in the history
To make the workflow dependency chain, the best approach is to use
the reusable workflow feature.

Signed-off-by: Matheus Castello <[email protected]>
  • Loading branch information
microhobby committed Jan 15, 2025
1 parent f602a3b commit 9c5f4d7
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 44 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
@@ -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
secrets: inherit
needs:
- build-ccpp
- build-debug-ccpp
- build-debug-python
- build-python
- build-debug-rust
- build-rust
5 changes: 1 addition & 4 deletions .github/workflows/build-ccpp.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: C/C++ Containers
on:
push:
branches:
- dev
- bookworm
workflow_call:

jobs:
ccpp:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/build-debug-ccpp.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: C/C++ Debug Containers
on:
push:
branches:
- dev
- bookworm
workflow_call:

jobs:
ccpp-debug:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/build-debug-python.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Python Debug Containers
on:
push:
branches:
- dev
- bookworm
workflow_call:

jobs:
python3-debug:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/build-debug-rust.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Rust Debug Containers
on:
push:
branches:
- dev
- bookworm
workflow_call:

jobs:
rust-debug:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/build-python.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Python Containers
on:
push:
branches:
- dev
- bookworm
workflow_call:

jobs:
python3:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/build-rust.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Rust Containers
on:
push:
branches:
- dev
- bookworm
workflow_call:

jobs:
rust:
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/ci-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Sanity Check
on:
push:
branches:
- dev
pull_request:
branches:
- dev
workflow_call:

jobs:
spell-check:
Expand Down
25 changes: 11 additions & 14 deletions .github/workflows/publish-torizon-utils.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
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:

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

Expand All @@ -33,6 +20,16 @@ jobs:
exit 69
fi
- name: Setup Python
run: |
sudo apt-get update
sudo apt-get install -y \
python3-pip \
python3-venv \
pipx \
python3-setuptools \
twine
- name: Create Package
run: |
cd ./scripts/utils/pip
Expand Down

0 comments on commit 9c5f4d7

Please sign in to comment.