Skip to content

Commit 9e76551

Browse files
committed
Define project-first task and CI naming
Change-Id: Icd77be234f2638cc30dff3a0472cbb1bcddc97f3
1 parent 1457ae8 commit 9e76551

51 files changed

Lines changed: 1347 additions & 1044 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazel/Taskfile.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# https://taskfile.dev
2+
# Bazel-owned maintenance and metadata tasks.
3+
4+
version: '3'
5+
6+
vars:
7+
NIX_RUN: '{{printf "%s/../scripts/nix_run.sh" .TASKFILE_DIR}}'
8+
9+
tasks:
10+
cache-ci-build-dependencies:
11+
desc: Cache the build dependencies expected by the Bazel CI jobs
12+
cmd: '{{.NIX_RUN}} ./scripts/cache_bazel_ci_build_dependencies.sh'
13+
14+
check-fmt:
15+
desc: Check that BUILD.bazel files are formatted with buildifier
16+
cmds:
17+
- task: fmt
18+
- cmd: '{{.NIX_RUN}} ./scripts/run_task.sh git:check-clean-branch'
19+
20+
check-gazelle-generate:
21+
desc: Check that generated BUILD files are up-to-date
22+
cmd: '{{.NIX_RUN}} bazelisk test //:gazelle_test'
23+
24+
check-generate-patches:
25+
desc: Checks that generated patches are up-to-date (requires a clean working tree)
26+
cmds:
27+
- task: generate-patches
28+
- cmd: '{{.NIX_RUN}} ./scripts/run_task.sh git:check-clean-branch'
29+
30+
check-metadata:
31+
desc: Checks Bazel metadata is current (requires clean git tree)
32+
cmd: '{{.NIX_RUN}} ./scripts/check_bazel_metadata.sh'
33+
34+
check-module-metadata:
35+
desc: Checks that Bazel module metadata is up-to-date (requires a clean working tree)
36+
cmds:
37+
- task: sync-module-metadata
38+
- cmd: '{{.NIX_RUN}} ./scripts/run_task.sh git:check-clean-branch'
39+
40+
check-multiple-go-libraries:
41+
desc: Check that each BUILD.bazel defines at most one go_library
42+
cmd: '{{.NIX_RUN}} ./scripts/check_bazel_multiple_go_libraries.sh'
43+
44+
clean:
45+
desc: Clean Bazel cache
46+
cmd: '{{.NIX_RUN}} bazelisk clean'
47+
48+
clean-all:
49+
desc: Clean Bazel cache (full expunge)
50+
cmd: '{{.NIX_RUN}} bazelisk clean --expunge'
51+
52+
configure-local:
53+
desc: Generate .bazelrc.local, if necessary, with appropriate values for the local host
54+
cmd: '{{.NIX_RUN}} ./scripts/generate_bazelrc_local.sh'
55+
56+
fmt:
57+
desc: Format BUILD.bazel files with buildifier
58+
cmd: '{{.NIX_RUN}} bazelisk run @buildifier_prebuilt//:buildifier -- -r .'
59+
60+
gazelle-generate:
61+
desc: Regenerate BUILD files with Gazelle (all modules)
62+
cmd: '{{.NIX_RUN}} bazelisk run //:gazelle'
63+
64+
generate-metadata:
65+
desc: Regenerate Bazel metadata for this source tree
66+
cmds:
67+
- task: gazelle-generate
68+
- task: fmt
69+
- task: generate-patches
70+
- task: sync-module-metadata
71+
72+
generate-patches:
73+
desc: Regenerate .patch files from BUILD files in .bazel/patches/build_files/
74+
cmd: '{{.NIX_RUN}} ./scripts/generate_bazel_patches.sh'
75+
76+
mod-tidy:
77+
desc: Update use_repo() in MODULE.bazel from go.mod
78+
cmd: '{{.NIX_RUN}} bazelisk mod tidy'
79+
80+
sync-module-metadata:
81+
desc: Refresh Bazel module metadata files (MODULE.bazel and MODULE.bazel.lock)
82+
cmds:
83+
- task: mod-tidy
84+
- cmd: '{{.NIX_RUN}} bazelisk mod deps --lockfile_mode=update >/dev/null'

.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
if [ -n "${AVALANCHEGO_DIRENV_USE_FLAKE}" ]; then
22
if ! command -v nix > /dev/null; then
3-
echo "To enable entering a dev shell via this .envrc: ./scripts/run_task.sh install-nix"
3+
echo "To enable entering a dev shell via this .envrc: ./scripts/run_task.sh tools:install-nix"
44
else
55
# nix-direnv speeds up flake evaluation vs the built-in direnv support
66
# due to caching and the avoidance of nix garbage collection.

.github/actions/c-chain-reexecution-benchmark/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ runs:
146146
run: echo "BENCHMARK_OUTPUT_FILE=${GITHUB_WORKSPACE}/benchmark-output.json" >> "$GITHUB_ENV"
147147
- name: Run C-Chain Re-execution Benchmark
148148
shell: nix develop --impure --command bash -x {0}
149-
run: ./scripts/run_task.sh test-cchain-reexecution -- "${{ inputs.test || '' }}"
149+
run: ./scripts/run_task.sh avalanchego:test-cchain-reexecution -- "${{ inputs.test || '' }}"
150150
env:
151151
# Test configuration overrides
152152
BLOCK_DIR_SRC: ${{ inputs.block-dir-src }}

.github/actions/setup-bazel/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ runs:
6969
- name: Check Bazel metadata
7070
if: ${{ inputs.initial-setup == 'true' }}
7171
shell: bash
72-
run: ./scripts/run_task.sh bazel-check-metadata
72+
run: ./scripts/run_task.sh bazel:check-metadata
7373

7474
- name: Cache Bazel CI build dependencies
7575
if: ${{ inputs.initial-setup == 'true' }}
7676
shell: bash
77-
run: ./scripts/run_task.sh bazel-cache-ci-build-dependencies
77+
run: ./scripts/run_task.sh bazel:cache-ci-build-dependencies

.github/packaging/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The packaging pipeline builds two packages per format and architecture:
5050
Build and validate the full RPM pipeline locally with:
5151

5252
```bash
53-
./scripts/run_task.sh --taskfile .github/packaging/Taskfile.yml test-build-rpms
53+
./scripts/run_task.sh packaging:test-build-rpms
5454
```
5555

5656
Build and validate the full DEB pipeline locally with:
Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,32 @@
11
name: Bazel
22

3-
# Top-level Bazel CI entrypoint. This workflow defines the platform matrix
3+
# Orchestrates Bazel CI across supported platforms. The matrix fan-out happens
44
# once and invokes bazel-ci.yml once per platform.
55
on:
66
push:
7-
tags:
8-
- "*"
97
branches:
108
- master
11-
- dev
129
pull_request:
1310
merge_group:
1411
types: [checks_requested]
1512

1613
env:
1714
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1815

19-
permissions:
20-
contents: read
21-
22-
# Cancel ongoing workflow runs if a new one is started
23-
concurrency:
24-
group: ${{ github.workflow }}-${{ github.ref }}
25-
cancel-in-progress: true
26-
2716
jobs:
28-
bz-define-matrix:
29-
runs-on: ubuntu-24.04
30-
outputs:
31-
platforms: ${{ steps.set-platforms.outputs.platforms }}
32-
steps:
33-
- name: Define platform matrix
34-
id: set-platforms
35-
shell: bash
36-
run: |
37-
echo 'platforms=["linux-amd64","linux-arm64","darwin-arm64"]' >> "$GITHUB_OUTPUT"
38-
matrix:
39-
needs: bz-define-matrix
40-
name: ${{ matrix.platform }}
17+
bazel:
4118
strategy:
4219
fail-fast: false
4320
matrix:
44-
platform: ${{ fromJSON(needs.bz-define-matrix.outputs.platforms) }}
21+
include:
22+
- platform_name: linux-amd64
23+
runner: ubuntu-24.04
24+
- platform_name: linux-arm64
25+
runner: ubuntu-24.04-arm
26+
- platform_name: darwin-arm64
27+
runner: macos-26
4528
uses: ./.github/workflows/bazel-ci.yml
4629
with:
47-
platform_name: ${{ matrix.platform }}
48-
runner: ${{ matrix.platform == 'linux-amd64' && 'ubuntu-24.04' || matrix.platform == 'linux-arm64' && 'ubuntu-24.04-arm' || 'macos-26' }}
30+
platform_name: ${{ matrix.platform_name }}
31+
runner: ${{ matrix.runner }}
4932
secrets: inherit

.github/workflows/bazel-ci.yml

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name: Bazel Jobs
22

3-
# Reusable Bazel CI workflow for one platform. This workflow is called by
4-
# bazel-ci-matrix.yml with a platform name and runner.
53
on:
64
workflow_call:
75
inputs:
@@ -20,17 +18,15 @@ permissions:
2018
contents: read
2119

2220
jobs:
23-
# Aggregate the per-platform Bazel checks into one stable required job.
24-
# GitHub Actions job graphs are static, so Bazel still runs inside each
25-
# declared job.
26-
bazel-required:
21+
required:
2722
if: ${{ always() }}
2823
needs:
2924
- setup
30-
- unit-main
31-
- unit-coreth
32-
- unit-subnet-evm
33-
- e2e
25+
- avalanchego-test-unit
26+
- coreth-test-unit
27+
- evm-test-unit
28+
- subnet-evm-test-unit
29+
- avalanchego-test-e2e
3430
runs-on: ${{ inputs.runner }}
3531
steps:
3632
- name: Fail unless all needed jobs succeeded
@@ -52,50 +48,61 @@ jobs:
5248
exit 1
5349
fi
5450
55-
# Prepare Bazel CI for this platform before the later jobs run. Similar in intent to
56-
# setup-go, this job uses setup-bazel to check Bazel metadata and prepare cache
57-
# state for the dependencies that subsequent jobs are expected to need. That shifts
58-
# network access into one upfront step instead of having each later job discover
59-
# missing dependencies on its own.
6051
setup:
52+
name: setup
6153
runs-on: ${{ inputs.runner }}
6254
steps:
6355
- uses: actions/checkout@v5
6456
- uses: ./.github/actions/setup-bazel
6557
with:
6658
initial-setup: true
6759

68-
unit-main:
60+
avalanchego-test-unit:
61+
name: avalanchego-test-unit
6962
needs: setup
7063
runs-on: ${{ inputs.runner }}
7164
steps:
7265
- uses: actions/checkout@v5
7366
- uses: ./.github/actions/setup-bazel
74-
- name: Run unit tests with Bazel
67+
- name: Run avalanchego unit tests with Bazel
7568
shell: bash
76-
run: ./scripts/run_task.sh bazel-test-main
69+
run: ./scripts/run_task.sh avalanchego:test-unit-bazel
7770

78-
unit-coreth:
71+
coreth-test-unit:
72+
name: coreth-test-unit
7973
needs: setup
8074
runs-on: ${{ inputs.runner }}
8175
steps:
8276
- uses: actions/checkout@v5
8377
- uses: ./.github/actions/setup-bazel
8478
- name: Run coreth unit tests with Bazel
8579
shell: bash
86-
run: ./scripts/run_task.sh bazel-test-coreth
80+
run: ./scripts/run_task.sh coreth:test-unit-bazel
8781

88-
unit-subnet-evm:
82+
evm-test-unit:
83+
name: evm-test-unit
84+
needs: setup
85+
runs-on: ${{ inputs.runner }}
86+
steps:
87+
- uses: actions/checkout@v5
88+
- uses: ./.github/actions/setup-bazel
89+
- name: Run evm unit tests with Bazel
90+
shell: bash
91+
run: ./scripts/run_task.sh evm:test-unit-bazel
92+
93+
subnet-evm-test-unit:
94+
name: subnet-evm-test-unit
8995
needs: setup
9096
runs-on: ${{ inputs.runner }}
9197
steps:
9298
- uses: actions/checkout@v5
9399
- uses: ./.github/actions/setup-bazel
94100
- name: Run subnet-evm unit tests with Bazel
95101
shell: bash
96-
run: ./scripts/run_task.sh bazel-test-subnet-evm
102+
run: ./scripts/run_task.sh subnet-evm:test-unit-bazel
97103

98-
e2e:
104+
avalanchego-test-e2e:
105+
name: avalanchego-test-e2e
99106
needs: setup
100107
runs-on: ${{ inputs.runner }}
101108
steps:
@@ -104,7 +111,7 @@ jobs:
104111
- name: Run e2e tests with Bazel-built binary
105112
uses: ./.github/actions/run-monitored-tmpnet-cmd
106113
with:
107-
run: ./scripts/run_task.sh bazel-test-e2e-ci
114+
run: ./scripts/run_task.sh avalanchego:test-e2e-bazel-ci
108115
artifact_prefix: e2e-bazel-${{ inputs.platform_name }}
109116
filter_by_owner: avalanchego-e2e
110117
prometheus_url: ${{ secrets.PROMETHEUS_URL || '' }}

.github/workflows/build-linux-binaries.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ jobs:
2828
- run: go version
2929

3030
- name: Build the avalanchego binaries
31-
run: ./scripts/run_task.sh build
31+
run: ./scripts/run_task.sh avalanchego:build-gomod
3232

3333
- name: Build subnet-evm plugin
34-
working-directory: ./graft/subnet-evm
35-
run: ./scripts/run_task.sh build
34+
run: ./scripts/run_task.sh subnet-evm:build
3635

3736
- name: Install aws cli
3837
run: sudo snap install aws-cli --classic
@@ -98,11 +97,10 @@ jobs:
9897
- run: go version
9998

10099
- name: Build the avalanchego binaries
101-
run: ./scripts/run_task.sh build
100+
run: ./scripts/run_task.sh avalanchego:build-gomod
102101

103102
- name: Build subnet-evm plugin
104-
working-directory: ./graft/subnet-evm
105-
run: ./scripts/run_task.sh build
103+
run: ./scripts/run_task.sh subnet-evm:build
106104

107105
- name: Install aws cli
108106
run: sudo snap install aws-cli --classic
@@ -150,6 +148,6 @@ jobs:
150148
path: /tmp/avalanchego/subnet-evm-linux-arm64-${{ env.TAG }}.tar.gz
151149

152150
- name: Cleanup
153-
run: |
151+
run: |-
154152
rm -rf ./build
155153
rm -rf /tmp/avalanchego

.github/workflows/build-macos-release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ jobs:
3838

3939
# Runs a single command using the runners shell
4040
- name: Build the avalanchego binary
41-
run: ./scripts/run_task.sh build
41+
run: ./scripts/run_task.sh avalanchego:build-gomod
4242

4343
- name: Build subnet-evm plugin
44-
working-directory: ./graft/subnet-evm
45-
run: ./scripts/run_task.sh build
44+
run: ./scripts/run_task.sh subnet-evm:build
4645

4746
- name: Try to get tag from git
4847
if: "${{ github.event.inputs.tag == '' }}"
@@ -103,5 +102,5 @@ jobs:
103102
path: subnet-evm-macos-${{ env.TAG }}.zip
104103

105104
- name: Cleanup
106-
run: |
105+
run: |-
107106
rm -rf ./build

.github/workflows/c-chain-reexecution-benchmark-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
- name: Configure dependency versions
112112
if: matrix.libevm-ref != '' || matrix.firewood-ref != ''
113113
shell: nix develop --command bash {0}
114-
run: ./scripts/run_task.sh run-polyrepo
114+
run: ./scripts/run_task.sh tools:run-polyrepo
115115
env:
116116
LIBEVM_REF: ${{ matrix.libevm-ref }}
117117
FIREWOOD_REF: ${{ matrix.firewood-ref }}

0 commit comments

Comments
 (0)