Skip to content

Commit fbc8bf4

Browse files
committed
Run pre-commit checks in extra job
The build job is run for amd64 and arm64. However not all bazel dependencies are available for arm64 and thus these checks can only be run on amd64.
1 parent 3c79814 commit fbc8bf4

2 files changed

Lines changed: 38 additions & 6 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ concurrency:
2121
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
2222
cancel-in-progress: true
2323
jobs:
24+
pre-commit:
25+
runs-on: ubuntu-24.04
26+
permissions:
27+
contents: read
28+
steps:
29+
- uses: actions/checkout@v6
30+
- uses: actions/setup-python@v6
31+
# code mostly taken from https://github.com/pre-commit/action/blob/main/action.yml
32+
- run: python -m pip install pre-commit==4.5.1
33+
shell: bash
34+
- run: python -m pip freeze --local
35+
shell: bash
36+
- uses: actions/cache@v5
37+
with:
38+
path: ~/.cache/pre-commit
39+
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
40+
- run: pre-commit run --show-diff-on-failure --color=always --all-files
41+
shell: bash
2442
build:
2543
strategy:
2644
matrix:
@@ -34,6 +52,7 @@ jobs:
3452
runner: ubuntu-24.04-arm
3553
name: ${{ matrix.name }}
3654
runs-on: ${{ matrix.runner }}
55+
needs: pre-commit
3756
permissions:
3857
contents: read
3958
packages: write
@@ -57,9 +76,6 @@ jobs:
5776
runCmd: |
5877
set -eux pipefail
5978
60-
# Check
61-
pre-commit run --show-diff-on-failure --color=always --all-files || exit 1
62-
6379
# Create builder for multi-arch builds
6480
./scripts/create_builder.sh
6581

.github/workflows/release.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ on:
1717
tags:
1818
- v[0-9]+.[0-9]+.[0-9]+
1919
jobs:
20+
pre-commit:
21+
runs-on: ubuntu-24.04
22+
permissions:
23+
contents: read
24+
steps:
25+
- uses: actions/checkout@v6
26+
- uses: actions/setup-python@v6
27+
# code mostly taken from https://github.com/pre-commit/action/blob/main/action.yml
28+
- run: python -m pip install pre-commit==4.5.1
29+
shell: bash
30+
- run: python -m pip freeze --local
31+
shell: bash
32+
- uses: actions/cache@v5
33+
with:
34+
path: ~/.cache/pre-commit
35+
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
36+
- run: pre-commit run --show-diff-on-failure --color=always --all-files
37+
shell: bash
2038
build:
2139
strategy:
2240
matrix:
@@ -30,6 +48,7 @@ jobs:
3048
runner: ubuntu-24.04-arm
3149
name: ${{ matrix.name }}
3250
runs-on: ${{ matrix.runner }}
51+
needs: pre-commit
3352
permissions:
3453
contents: read
3554
packages: write
@@ -53,9 +72,6 @@ jobs:
5372
runCmd: |
5473
set -eux pipefail
5574
56-
# Check
57-
pre-commit run --show-diff-on-failure --color=always --all-files || exit 1
58-
5975
# Create builder for multi-arch builds
6076
./scripts/create_builder.sh
6177

0 commit comments

Comments
 (0)