-
Notifications
You must be signed in to change notification settings - Fork 837
ci: composable avalanchego action #4341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
966eb57
ec8fe0e
36f8420
8a517e5
04a9aa8
1477677
58784da
bec87c7
ebeafdc
17af2a7
76b7009
7aafbae
35e7eb6
2ea5241
0e863be
b63ffe4
18e728c
3dfbc38
dfa8c81
06708b0
fb8a6cf
da4c389
6a09874
2c84ad9
f1a55c7
4702f81
7ac895c
26443d9
833f844
4257069
24805ed
7503a0c
9f82ca8
db1bbc5
4df4b98
1674dfa
6de7ef2
6b212a9
07ada03
79f3d9b
106ee40
57329f2
daff6b5
9f9d92d
5964641
70fbc9f
d5bc227
ff86c39
b88c5ea
c753cf9
7b3a231
c0281ed
10c5ef7
7d7956c
a42e26b
785278f
c5b650a
20c4ad0
f9b3ce0
519e92a
f3d56fb
69c38b5
a800ff1
f7f0ccf
ef5cae7
7921a03
e703fe0
d359c7a
30e7b0c
0cb04dc
8082a9e
3b2a82f
3483737
c14c088
c932542
723d07f
bb3d233
1c8434f
a1485bb
c32a622
8fd517e
e51f0fd
b689bd3
2a69c0e
665eaf8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # AvalancheGo Setup Action | ||
|
|
||
| ## Overview | ||
| This action provides composable CI capabilities for setting up AvalancheGo with custom dependency versions. | ||
|
|
||
| ### Why this exists? | ||
| Solves CI composability problems by enabling repositories to setup and build AvalancheGo with specific dependency versions without complex setup or cross-repository coordination. | ||
|
|
||
| ### Why is it needed? | ||
| Dependencies need AvalancheGo as their integration context for realistic testing. | ||
| Without this action, setting up AvalancheGo with custom dependency versions requires build knowledge and manual `go mod` manipulation. | ||
| Teams either skip proper testing or dump tests in AvalancheGo (wrong ownership). | ||
| This action makes AvalancheGo composable - any repository can pull it in as integration context with one line. | ||
|
|
||
| ## Security Model | ||
| - Repository Restriction: Only allows dependencies from `github.com/ava-labs/*` repositories | ||
| - No Custom Forks: Prevents supply chain attacks from malicious forks | ||
| - Commit Validation: Validates dependency versions reference ava-labs repositories only | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Input | Description | Required | Default | | ||
| |-------|-------------|----------|-----------------------| | ||
| | `checkout-path` | Directory path where AvalancheGo will be checked out | No | `'.'` | | ||
| | `avalanchego` | AvalancheGo version (commit SHA, branch, tag) | No | `'${{ github.sha }}'` | | ||
| | `firewood` | Firewood version. Consumer should run Firewood shared workflow first | No | `''` | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where's the firewood dir? |
||
| | `coreth` | Coreth version (commit SHA, branch, tag) | No | `''` | | ||
| | `libevm` | LibEVM version (commit SHA, branch, tag) | No | `''` | | ||
|
|
||
| ## Usage Examples | ||
|
|
||
| ```yaml | ||
| - name: Setup AvalancheGo with Firewood # This will setup go.mod | ||
| uses: ./.github/actions/avalanchego-setup-action | ||
| with: | ||
| checkout-path: "build/avalanchego" | ||
| coreth: "my-feature-branch" | ||
| libevm: "experimental-branch" | ||
| firewood: "ffi/v0.0.12" | ||
| - name: Load test # This will compile and run the load test | ||
| uses: ./.github/actions/run-monitored-tmpnet-cmd | ||
| with: | ||
| run: ./scripts/run_task.sh test-load -- --load-timeout=30m --firewood | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: 'Setup AvalancheGo' | ||
| description: 'Setup AvalancheGo with custom dependencies (Firewood, Coreth, LibEVM)' | ||
|
|
||
| inputs: | ||
| avalanchego: | ||
| description: 'AvalancheGo version (commit SHA, branch name, or tag)' | ||
| required: false | ||
| default: ${{ github.sha }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This reference only makes sense if the custom action will only be used in the avalanchego repo. |
||
| checkout-path: | ||
| description: 'Path where AvalancheGo will be checked out' | ||
| required: false | ||
| default: '.' | ||
| firewood: | ||
| description: 'Firewood version (commit SHA, branch, tag, or ffi/vX.Y.Z for pre-built)' | ||
| required: false | ||
| default: '' | ||
| firewood-path: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Under what circumstances will this actually be used? |
||
| description: 'Directory path where Firewood will be cloned/built (preferably NVMe storage)' | ||
| required: false | ||
| default: '' | ||
| coreth: | ||
| description: 'Coreth version (commit SHA, branch name, or tag)' | ||
| required: false | ||
| default: '' | ||
| libevm: | ||
| description: 'LibEVM version (commit SHA, branch name, or tag)' | ||
| required: false | ||
| default: '' | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Checkout AvalancheGo | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only non-task step that I would expect to see in an action with the remain steps being part of a task.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a fair point. I can see the appeal of consolidating all go.mod updates in one place. I'm thinking of keeping coreth/libevm updates explicit in the action makes the dependency changes visible and optional. They're simple That said, I'm not strongly opposed to consolidating them. Do you see a clear advantage to moving them into the script? Or is this more about having a consistent pattern for where dependency management happens? Happy to restructure if there's a compelling reason I'm missing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The pattern for the majority of our CI jobs is that they are trivial to reproduce locally. That means, apart from CI-specific setup like cloning, caching and installing non-nix deps, the meat of a given job is encapsulated in a task that can be invoked locally. CI jobs are then just the glue between Github Actions and our tasks. This ensures both reproducibility and simplifies development and maintenance of our jobs. |
||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: 'ava-labs/avalanchego' | ||
| ref: ${{ inputs.avalanchego }} | ||
| path: ${{ inputs.checkout-path }} | ||
| - name: Update Coreth dependency | ||
| if: inputs.coreth != '' | ||
| shell: bash | ||
| working-directory: ${{ inputs.checkout-path }} | ||
| run: | | ||
| echo "Updating Coreth to version: ${{ inputs.coreth }}" | ||
| go get github.com/ava-labs/coreth@${{ inputs.coreth }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What guarantees are there that a given version of coreth is going to be compatible with given versions of avalanchego or firewood? |
||
| - name: Update LibEVM dependency | ||
| if: inputs.libevm != '' | ||
| shell: bash | ||
| working-directory: ${{ inputs.checkout-path }} | ||
| run: | | ||
| echo "Updating LibEVM to version: ${{ inputs.libevm }}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What guarantees are there that a given version of libevm is going to be compatible with given versions of avalanchego and coreth? |
||
| go get github.com/ava-labs/libevm@${{ inputs.libevm }} | ||
| - name: Setup Firewood FFI | ||
| if: inputs.firewood != '' | ||
| id: setup-firewood | ||
| uses: ava-labs/firewood/.github/actions/build-action@composable-ci-action | ||
| with: | ||
| version: ${{ inputs.firewood }} | ||
| workspace-path: ${{ inputs.firewood-path }} | ||
| - name: Configure Go modules with Firewood FFI | ||
| if: inputs.firewood != '' | ||
| shell: bash | ||
| working-directory: ${{ inputs.checkout-path }} | ||
| run: | | ||
| FFI_PATH="${{ steps.setup-firewood.outputs.ffi-path }}" | ||
| echo "Updating go.mod with FFI path: ${FFI_PATH}" | ||
| go mod edit -replace github.com/ava-labs/firewood-go-ethhash/ffi="${FFI_PATH}" | ||
| go mod tidy | ||
| go mod download | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # WARNING: This file is a duplication of: | ||
| # - .github/actions/run-monitored-tmpnet-cmd/output-metrics-url.sh (source of truth) | ||
| # Changes must be made to BOTH files. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Timestamps are in seconds | ||
| from_timestamp="$(date '+%s')" | ||
| monitoring_period=900 # 15 minutes | ||
| to_timestamp="$((from_timestamp + monitoring_period))" | ||
|
|
||
| # Export timestamps to GitHub environment | ||
| if [ -n "${GITHUB_ENV:-}" ]; then | ||
| echo "METRICS_FROM_TIMESTAMP=${from_timestamp}" >> "$GITHUB_ENV" | ||
| echo "METRICS_TO_TIMESTAMP=${to_timestamp}" >> "$GITHUB_ENV" | ||
| fi | ||
|
|
||
| # Grafana expects microseconds, so pad timestamps with 3 zeros | ||
| metrics_url="${GRAFANA_URL}&var-filter=gh_job_id%7C%3D%7C${GH_JOB_ID}&from=${from_timestamp}000&to=${to_timestamp}000" | ||
|
|
||
| # Optionally ensure that the link displays metrics only for the shared | ||
| # network rather than mixing it with the results for private networks. | ||
| if [[ -n "${FILTER_BY_OWNER:-}" ]]; then | ||
| metrics_url="${metrics_url}&var-filter=network_owner%7C%3D%7C${FILTER_BY_OWNER}" | ||
| fi | ||
|
|
||
| echo "${metrics_url}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this suggested?