Skip to content

Commit b19e7bd

Browse files
committed
Better way of reusing ci workflow
Instead of dynamically checking and updating the ARM/AMD runner type, we can use reusable workflows and statically define two types of workflows: ARM and AMD. There are some benefits of that approach: * we can run only AMD workflows for "PRs" - they will be in the same AMD workflow * AMD / ARM workflows are run at fixed hours * There is no dynamic checking for workflows when running selective checks * Most importantly - both AMD and ARM workflows run in `vX-Y-test` branches after merge (previously they were alternating - similarly to canary builds)
1 parent f8c6e81 commit b19e7bd

File tree

9 files changed

+158
-99
lines changed

9 files changed

+158
-99
lines changed

.github/workflows/ci-amd.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
name: Tests AMD
20+
on: # yamllint disable-line rule:truthy
21+
schedule:
22+
- cron: '28 1,7,13,19 * * *'
23+
push:
24+
branches:
25+
- v[0-9]+-[0-9]+-test
26+
- providers-[a-z]+-?[a-z]*/v[0-9]+-[0-9]+
27+
pull_request:
28+
branches:
29+
- main
30+
- v[0-9]+-[0-9]+-test
31+
- v[0-9]+-[0-9]+-stable
32+
- providers-[a-z]+-?[a-z]*/v[0-9]+-[0-9]+
33+
types: [opened, reopened, synchronize, ready_for_review]
34+
workflow_dispatch:
35+
permissions:
36+
# All other permissions are set to none by default
37+
contents: write
38+
packages: write
39+
id-token: write
40+
jobs:
41+
call-workflow:
42+
uses: ./.github/workflows/reusable-ci-workflow.yml
43+
with:
44+
architecture: 'AMD'
45+
secrets:
46+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
47+
DOCS_AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
48+
DOCS_AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }}

.github/workflows/ci-arm.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
name: Tests ARM
20+
on: # yamllint disable-line rule:truthy
21+
schedule:
22+
- cron: '28 5,11,17,23 * * *'
23+
push:
24+
branches:
25+
- v[0-9]+-[0-9]+-test
26+
- providers-[a-z]+-?[a-z]*/v[0-9]+-[0-9]+
27+
pull_request:
28+
branches:
29+
- v[0-9]+-[0-9]+-test
30+
- v[0-9]+-[0-9]+-stable
31+
- providers-[a-z]+-?[a-z]*/v[0-9]+-[0-9]+
32+
types: [opened, reopened, synchronize, ready_for_review]
33+
workflow_dispatch:
34+
permissions:
35+
# All other permissions are set to none by default
36+
contents: write
37+
packages: write
38+
id-token: write
39+
jobs:
40+
call-workflow:
41+
uses: ./.github/workflows/reusable-ci-workflow.yml
42+
with:
43+
architecture: 'ARM'
44+
secrets:
45+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
46+
# No need to pass AWS creds as ARM builds do not build docs

.github/workflows/ci-amd-arm.yml renamed to .github/workflows/reusable-ci-workflow.yml

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,22 @@
1818
---
1919
name: Tests
2020
on: # yamllint disable-line rule:truthy
21-
schedule:
22-
- cron: '28 1,3,7,9,13,15,19,21 * * *'
23-
push:
24-
branches:
25-
- v[0-9]+-[0-9]+-test
26-
- providers-[a-z]+-?[a-z]*/v[0-9]+-[0-9]+
27-
pull_request:
28-
branches:
29-
- main
30-
- v[0-9]+-[0-9]+-test
31-
- v[0-9]+-[0-9]+-stable
32-
- providers-[a-z]+-?[a-z]*/v[0-9]+-[0-9]+
33-
types: [opened, reopened, synchronize, ready_for_review]
34-
workflow_dispatch:
21+
workflow_call:
22+
inputs:
23+
architecture:
24+
description: "Architecture for the build - 'ARM' or 'AMD'"
25+
required: true
26+
type: string
27+
secrets:
28+
SLACK_BOT_TOKEN:
29+
description: "Slack bot token to use for notifications"
30+
required: true
31+
DOCS_AWS_ACCESS_KEY_ID:
32+
description: "AWS Access Key ID for uploading docs (only needed for AMD builds)"
33+
required: false
34+
DOCS_AWS_SECRET_ACCESS_KEY:
35+
description: "AWS Secret Access Key for uploading docs (only needed for AMD builds)"
36+
required: false
3537
permissions:
3638
# All other permissions are set to none by default
3739
contents: read
@@ -160,30 +162,23 @@ jobs:
160162
PR_LABELS: "${{ steps.source-run-info.outputs.pr-labels }}"
161163
COMMIT_REF: "${{ github.sha }}"
162164
VERBOSE: "false"
165+
ARCHITECTURE: ${{ inputs.architecture }}
163166
run: breeze ci selective-check 2>> ${GITHUB_OUTPUT}
164167
- name: env
165168
run: printenv
166169
env:
167170
PR_LABELS: ${{ steps.source-run-info.outputs.pr-labels }}
168171
GITHUB_CONTEXT: ${{ toJson(github) }}
169172

170-
print-platform-arm:
171-
name: "Platform: ARM"
172-
needs: [build-info]
173-
runs-on: ["ubuntu-22.04"]
174-
if: needs.build-info.outputs.platform == 'linux/arm64'
175-
steps:
176-
- name: "Print architecture"
177-
run: "echo '## Architecture: ARM' >> $GITHUB_STEP_SUMMARY"
178-
179-
print-platform-amd:
180-
name: "Platform: AMD"
173+
print-platform:
174+
name: "Platform: ${{ inputs.architecture }}"
181175
needs: [build-info]
182176
runs-on: ["ubuntu-22.04"]
183-
if: needs.build-info.outputs.platform == 'linux/amd64'
184177
steps:
185178
- name: "Print architecture"
186-
run: "echo '## Architecture: AMD' >> $GITHUB_STEP_SUMMARY"
179+
run: "echo \"## Architecture: ${ARCHITECTURE}\" >> $GITHUB_STEP_SUMMARY"
180+
env:
181+
ARCHITECTURE: ${{ inputs.architecture }}
187182

188183
run-pin-versions-hook:
189184
name: "Pin actions"

0 commit comments

Comments
 (0)