Skip to content

Commit d61b52e

Browse files
committed
ci(common): simplify orchestration workflow
1 parent f6d601e commit d61b52e

25 files changed

+591
-1138
lines changed

.github/actionlint.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ self-hosted-runner:
1414
- m1mac
1515
- 4090-desktop
1616
- aws-mac1-metal
17+
18+
# Path-specific configurations
19+
paths:
20+
.github/workflows/**/*.{yml,yaml}:
21+
ignore:
22+
- SC2001 # https://www.shellcheck.net/wiki/SC2129
23+
- 'property "result" is not defined in object type.*'
24+
- '".*" section is alias node but mapping node is expected'
25+
- 'secret ".*" is required by ".*" reusable workflow.*'

.github/workflows/common-pull-request-lint.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
- name: actionlint
2525
uses: raven-actions/actionlint@3a24062651993d40fed1019b58ac6fbdfbf276cc # v2.0.1
2626
with:
27-
flags: "-ignore SC2001"
2827
version: ${{ env.ACTIONLINT_VERSION }}
2928

3029
- name: Ensure SHA pinned actions
@@ -48,4 +47,4 @@ jobs:
4847
uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0
4948
with:
5049
persona: pedantic
51-
version: 1.14.2
50+
version: 1.17.0
Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
name: coprocessor-db-migration-docker-build
22

33
on:
4-
workflow_dispatch:
4+
workflow_call:
5+
secrets:
6+
AWS_ACCESS_KEY_S3_USER:
7+
required: true
8+
AWS_SECRET_KEY_S3_USER:
9+
required: true
10+
BLOCKCHAIN_ACTIONS_TOKEN:
11+
required: true
12+
CGR_USERNAME:
13+
required: true
14+
CGR_PASSWORD:
15+
required: true
516
inputs:
6-
ref:
7-
description: 'Branch/ref to build'
8-
required: false
9-
default: 'main'
10-
type: string
11-
trigger_source:
12-
description: 'Source that triggered this workflow'
17+
is_workflow_call:
18+
description: 'To determine if the trigger was a workflow_call or a pull request'
19+
type: boolean
1320
required: false
14-
default: 'manual'
15-
type: string
21+
default: true
22+
outputs:
23+
build_result:
24+
description: "Result of the build job of this workflow"
25+
value: ${{ jobs.build.result }}
1626
pull_request:
1727
push:
1828
branches:
@@ -29,12 +39,14 @@ concurrency:
2939

3040
jobs:
3141
check-changes:
32-
name: coprocessor-db-migration-docker-build/check-changes
3342
permissions:
3443
actions: 'read' # Required to read workflow run information
3544
contents: 'read' # Required to checkout repository code
3645
pull-requests: 'read' # Required to read pull request information
3746
runs-on: ubuntu-latest
47+
if: |
48+
inputs.is_workflow_call ||
49+
(!inputs.is_workflow_call && !startsWith(github.head_ref, 'mergify/merge-queue/'))
3850
outputs:
3951
changes-coprocessor-db-migration: ${{ steps.filter.outputs.coprocessor-db-migration }}
4052
steps:
@@ -48,8 +60,8 @@ jobs:
4860
coprocessor-db-migration:
4961
- .github/workflows/coprocessor-db-migration-docker-build.yml
5062
- coprocessor/fhevm-engine/db-migration/**
63+
5164
build:
52-
name: coprocessor-db-migration-docker-build/build (bpr)
5365
needs: check-changes
5466
if: ${{ needs.check-changes.outputs.changes-coprocessor-db-migration == 'true' || github.event_name == 'release' }}
5567
uses: zama-ai/ci-templates/.github/workflows/common-docker.yml@6c72e3dbc894744c1e228fb165f4c4d657e475b6 # v1.0.1
@@ -74,27 +86,3 @@ jobs:
7486
image-name: "fhevm/coprocessor/db-migration"
7587
docker-file: "coprocessor/fhevm-engine/db-migration/Dockerfile"
7688
app-cache-dir: "fhevm-coprocessor-db-migration"
77-
output-build-status:
78-
name: coprocessor-db-migration-docker-build/output-build-status
79-
needs: [check-changes, build]
80-
if: always()
81-
permissions:
82-
contents: 'read'
83-
runs-on: ubuntu-latest
84-
outputs:
85-
image-built: ${{ steps.check-build.outputs.image-built }}
86-
image-tag: ${{ steps.check-build.outputs.image-tag }}
87-
steps:
88-
- name: Check if image was built
89-
id: check-build
90-
run: |
91-
# Check if docker build job ran and succeeded
92-
if [[ "${{ needs.build.result }}" == "success" ]]; then
93-
echo "image-built=true" >> "$GITHUB_OUTPUT"
94-
echo "image-tag=${{ github.sha }}" >> "$GITHUB_OUTPUT"
95-
echo "✅ Image was built successfully"
96-
else
97-
echo "image-built=false" >> "$GITHUB_OUTPUT"
98-
echo "image-tag=" >> "$GITHUB_OUTPUT"
99-
echo "⏭️ Image was not built (result: ${{ needs.build.result }})"
100-
fi
Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
name: coprocessor-gw-listener-docker-build
22

33
on:
4-
workflow_dispatch:
4+
workflow_call:
5+
secrets:
6+
AWS_ACCESS_KEY_S3_USER:
7+
required: true
8+
AWS_SECRET_KEY_S3_USER:
9+
required: true
10+
BLOCKCHAIN_ACTIONS_TOKEN:
11+
required: true
12+
CGR_USERNAME:
13+
required: true
14+
CGR_PASSWORD:
15+
required: true
516
inputs:
6-
ref:
7-
description: 'Branch/ref to build'
8-
required: false
9-
default: 'main'
10-
type: string
11-
trigger_source:
12-
description: 'Source that triggered this workflow'
17+
is_workflow_call:
18+
description: 'To determine if the trigger was a workflow_call or a pull request'
19+
type: boolean
1320
required: false
14-
default: 'manual'
15-
type: string
21+
default: true
22+
outputs:
23+
build_result:
24+
description: "Result of the build job of this workflow"
25+
value: ${{ jobs.build.result }}
1626
pull_request:
1727
push:
1828
branches:
@@ -29,12 +39,14 @@ concurrency:
2939

3040
jobs:
3141
check-changes:
32-
name: coprocessor-gw-listener-docker-build/check-changes
3342
permissions:
3443
actions: 'read' # Required to read workflow run information
3544
contents: 'read' # Required to checkout repository code
3645
pull-requests: 'read' # Required to read pull request information
3746
runs-on: ubuntu-latest
47+
if: |
48+
inputs.is_workflow_call ||
49+
(!inputs.is_workflow_call && !startsWith(github.head_ref, 'mergify/merge-queue/'))
3850
outputs:
3951
changes-coprocessor-gw-listener: ${{ steps.filter.outputs.coprocessor-gw-listener }}
4052
steps:
@@ -46,12 +58,12 @@ jobs:
4658
with:
4759
filters: |
4860
coprocessor-gw-listener:
49-
- .github/workflows/coprocessor-docker-build-gw-listener.yml
61+
- .github/workflows/coprocessor-gw-listener-docker-build.yml
5062
- coprocessor/fhevm-engine/gw-listener/**
5163
- coprocessor/fhevm-engine/Cargo.toml
5264
- coprocessor/fhevm-engine/Cargo.lock
65+
5366
build:
54-
name: coprocessor-gw-listener-docker-build/build
5567
needs: check-changes
5668
if: ${{ needs.check-changes.outputs.changes-coprocessor-gw-listener == 'true' || github.event_name == 'release' }}
5769
uses: zama-ai/ci-templates/.github/workflows/common-docker.yml@6c72e3dbc894744c1e228fb165f4c4d657e475b6 # v1.0.1
@@ -76,27 +88,3 @@ jobs:
7688
image-name: "fhevm/coprocessor/gw-listener"
7789
docker-file: "./coprocessor/fhevm-engine/gw-listener/Dockerfile"
7890
app-cache-dir: "fhevm-coprocessor-gw-listener"
79-
output-build-status:
80-
name: coprocessor-gw-listener-docker-build/output-build-status
81-
needs: [check-changes, build]
82-
if: always()
83-
permissions:
84-
contents: 'read'
85-
runs-on: ubuntu-latest
86-
outputs:
87-
image-built: ${{ steps.check-build.outputs.image-built }}
88-
image-tag: ${{ steps.check-build.outputs.image-tag }}
89-
steps:
90-
- name: Check if image was built
91-
id: check-build
92-
run: |
93-
# Check if docker build job ran and succeeded
94-
if [[ "${{ needs.build.result }}" == "success" ]]; then
95-
echo "image-built=true" >> "$GITHUB_OUTPUT"
96-
echo "image-tag=${{ github.sha }}" >> "$GITHUB_OUTPUT"
97-
echo "✅ Image was built successfully"
98-
else
99-
echo "image-built=false" >> "$GITHUB_OUTPUT"
100-
echo "image-tag=" >> "$GITHUB_OUTPUT"
101-
echo "⏭️ Image was not built (result: ${{ needs.build.result }})"
102-
fi
Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
name: coprocessor-host-listener-docker-build
22

33
on:
4-
workflow_dispatch:
4+
workflow_call:
5+
secrets:
6+
AWS_ACCESS_KEY_S3_USER:
7+
required: true
8+
AWS_SECRET_KEY_S3_USER:
9+
required: true
10+
BLOCKCHAIN_ACTIONS_TOKEN:
11+
required: true
12+
CGR_USERNAME:
13+
required: true
14+
CGR_PASSWORD:
15+
required: true
516
inputs:
6-
ref:
7-
description: 'Branch/ref to build'
8-
required: false
9-
default: 'main'
10-
type: string
11-
trigger_source:
12-
description: 'Source that triggered this workflow'
17+
is_workflow_call:
18+
description: 'To determine if the trigger was a workflow_call or a pull request'
19+
type: boolean
1320
required: false
14-
default: 'manual'
15-
type: string
21+
default: true
22+
outputs:
23+
build_result:
24+
description: "Result of the build job of this workflow"
25+
value: ${{ jobs.build.result }}
1626
pull_request:
1727
push:
1828
branches:
@@ -29,12 +39,14 @@ concurrency:
2939

3040
jobs:
3141
check-changes:
32-
name: coprocessor-host-listener-docker-build/check-changes
3342
permissions:
3443
actions: 'read' # Required to read workflow run information
3544
contents: 'read' # Required to checkout repository code
3645
pull-requests: 'read' # Required to read pull request information
3746
runs-on: ubuntu-latest
47+
if: |
48+
inputs.is_workflow_call ||
49+
(!inputs.is_workflow_call && !startsWith(github.head_ref, 'mergify/merge-queue/'))
3850
outputs:
3951
changes-coprocessor-host-listener: ${{ steps.filter.outputs.coprocessor-host-listener }}
4052
steps:
@@ -52,8 +64,8 @@ jobs:
5264
- coprocessor/fhevm-engine/Cargo.lock
5365
- host-contracts/contracts/*Events.sol
5466
- host-contracts/contracts/shared/**
67+
5568
build:
56-
name: coprocessor-host-listener-docker-build/build
5769
needs: check-changes
5870
if: ${{ needs.check-changes.outputs.changes-coprocessor-host-listener == 'true' || github.event_name == 'release' }}
5971
uses: zama-ai/ci-templates/.github/workflows/common-docker.yml@6c72e3dbc894744c1e228fb165f4c4d657e475b6 # v1.0.1
@@ -78,27 +90,3 @@ jobs:
7890
image-name: "fhevm/coprocessor/host-listener"
7991
docker-file: "coprocessor/fhevm-engine/host-listener/Dockerfile"
8092
app-cache-dir: "fhevm-coprocessor-host-listener"
81-
output-build-status:
82-
name: coprocessor-host-listener-docker-build/output-build-status
83-
needs: [check-changes, build]
84-
if: always()
85-
permissions:
86-
contents: 'read'
87-
runs-on: ubuntu-latest
88-
outputs:
89-
image-built: ${{ steps.check-build.outputs.image-built }}
90-
image-tag: ${{ steps.check-build.outputs.image-tag }}
91-
steps:
92-
- name: Check if image was built
93-
id: check-build
94-
run: |
95-
# Check if docker build job ran and succeeded
96-
if [[ "${{ needs.build.result }}" == "success" ]]; then
97-
echo "image-built=true" >> "$GITHUB_OUTPUT"
98-
echo "image-tag=${{ github.sha }}" >> "$GITHUB_OUTPUT"
99-
echo "✅ Image was built successfully"
100-
else
101-
echo "image-built=false" >> "$GITHUB_OUTPUT"
102-
echo "image-tag=" >> "$GITHUB_OUTPUT"
103-
echo "⏭️ Image was not built (result: ${{ needs.build.result }})"
104-
fi

0 commit comments

Comments
 (0)