Skip to content

Fix race in test

Fix race in test #5701

Workflow file for this run

name: Tests
on:
push:
tags:
- "*"
branches:
- master
- dev
pull_request:
merge_group:
types: [checks_requested]
permissions:
contents: read
# Cancel ongoing workflow runs if a new one is started
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
grafana_url: https://grafana-experimental.avax-dev.network/d/kBQpRdWnk/avalanche-main-dashboard?orgId=1&refresh=10s&var-filter=is_ephemeral_node%7C%3D%7Cfalse&var-filter=gh_repo%7C%3D%7Cava-labs%2Favalanchego&var-filter=gh_run_id%7C%3D%7C${{ github.run_id }}&var-filter=gh_run_attempt%7C%3D%7C${{ github.run_attempt }}
jobs:
Unit:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12, ubuntu-20.04, ubuntu-22.04, windows-2022, [self-hosted, linux, ARM64, focal], [self-hosted, linux, ARM64, jammy]]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project-v3
- name: Set timeout on Windows # Windows UT run slower and need a longer timeout
shell: bash
if: matrix.os == 'windows-2022'
run: echo "TIMEOUT=240s" >> $GITHUB_ENV
- name: build_test
shell: bash
run: ./scripts/build_test.sh
env:
TIMEOUT: ${{ env.TIMEOUT }}
Fuzz:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- name: fuzz_test
shell: bash
run: ./scripts/build_fuzz.sh 10 # Run each fuzz test 10 seconds
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- name: Build AvalancheGo Binary
shell: bash
run: ./scripts/build.sh -r
- name: Start prometheus
# Only run for the original repo; a forked repo won't have access to the monitoring credentials
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
shell: bash
run: bash -x ./scripts/run_prometheus.sh
env:
PROMETHEUS_ID: ${{ secrets.PROMETHEUS_ID }}
PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }}
- name: Start promtail
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
shell: bash
run: bash -x ./scripts/run_promtail.sh
env:
LOKI_ID: ${{ secrets.LOKI_ID }}
LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }}
- name: Notify of metrics availability
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
shell: bash
run: .github/workflows/notify-metrics-availability.sh
env:
GRAFANA_URL: ${{ env.grafana_url }}
GH_JOB_ID: ${{ github.job }}
FILTER_BY_OWNER: avalanchego-e2e
- name: Run e2e tests
shell: bash
run: E2E_SERIAL=1 ./scripts/tests.e2e.sh --delay-network-shutdown
env:
GH_REPO: ${{ github.repository }}
GH_WORKFLOW: ${{ github.workflow }}
GH_RUN_ID: ${{ github.run_id }}
GH_RUN_NUMBER: ${{ github.run_number }}
GH_RUN_ATTEMPT: ${{ github.run_attempt }}
GH_JOB_ID: ${{ github.job }}
- name: Upload tmpnet network dir
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-tmpnet-data
path: |
~/.tmpnet/networks
~/.tmpnet/prometheus/prometheus.log
~/.tmpnet/promtail/promtail.log
if-no-files-found: error
e2e_existing_network:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- name: Build AvalancheGo Binary
shell: bash
run: ./scripts/build.sh -r
- name: Start prometheus
# Only run for the original repo; a forked repo won't have access to the monitoring credentials
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
shell: bash
run: bash -x ./scripts/run_prometheus.sh
env:
PROMETHEUS_ID: ${{ secrets.PROMETHEUS_ID }}
PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }}
- name: Start promtail
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
shell: bash
run: bash -x ./scripts/run_promtail.sh
env:
LOKI_ID: ${{ secrets.LOKI_ID }}
LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }}
- name: Notify of metrics availability
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
shell: bash
run: .github/workflows/notify-metrics-availability.sh
env:
GRAFANA_URL: ${{ env.grafana_url }}
GH_JOB_ID: ${{ github.job }}
- name: Run e2e tests with existing network
shell: bash
run: E2E_SERIAL=1 ./scripts/tests.e2e.existing.sh --delay-network-shutdown
env:
GH_REPO: ${{ github.repository }}
GH_WORKFLOW: ${{ github.workflow }}
GH_RUN_ID: ${{ github.run_id }}
GH_RUN_NUMBER: ${{ github.run_number }}
GH_RUN_ATTEMPT: ${{ github.run_attempt }}
GH_JOB_ID: ${{ github.job }}
- name: Upload tmpnet network dir
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-existing-network-tmpnet-data
path: |
~/.tmpnet/networks
~/.tmpnet/prometheus/prometheus.log
~/.tmpnet/promtail/promtail.log
if-no-files-found: error
Upgrade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- name: Build AvalancheGo Binary
shell: bash
run: ./scripts/build.sh
- name: Start prometheus
# Only run for the original repo; a forked repo won't have access to the monitoring credentials
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
shell: bash
run: bash -x ./scripts/run_prometheus.sh
env:
PROMETHEUS_ID: ${{ secrets.PROMETHEUS_ID }}
PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }}
- name: Start promtail
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
shell: bash
run: bash -x ./scripts/run_promtail.sh
env:
LOKI_ID: ${{ secrets.LOKI_ID }}
LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }}
- name: Notify of metrics availability
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
shell: bash
run: .github/workflows/notify-metrics-availability.sh
env:
GRAFANA_URL: ${{ env.grafana_url }}
GH_JOB_ID: ${{ github.job }}
- name: Run e2e tests
shell: bash
run: ./scripts/tests.upgrade.sh
env:
GH_REPO: ${{ github.repository }}
GH_WORKFLOW: ${{ github.workflow }}
GH_RUN_ID: ${{ github.run_id }}
GH_RUN_NUMBER: ${{ github.run_number }}
GH_RUN_ATTEMPT: ${{ github.run_attempt }}
GH_JOB_ID: ${{ github.job }}
- name: Upload tmpnet network dir
uses: actions/upload-artifact@v4
if: always()
with:
name: upgrade-tmpnet-data
path: |
~/.tmpnet/networks
~/.tmpnet/prometheus/prometheus.log
~/.tmpnet/promtail/promtail.log
if-no-files-found: error
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- name: Run static analysis tests
shell: bash
run: scripts/lint.sh
- name: Run shellcheck
shell: bash
run: scripts/shellcheck.sh
buf-lint:
name: Protobuf Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.31.0
with:
github_token: ${{ github.token }}
- uses: bufbuild/buf-lint-action@v1
with:
input: "proto"
check_generated_protobuf:
name: Up-to-date protobuf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- uses: bufbuild/buf-setup-action@v1.31.0
- shell: bash
run: scripts/protobuf_codegen.sh
- shell: bash
run: .github/workflows/check-clean-branch.sh
check_mockgen:
name: Up-to-date mocks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- shell: bash
run: scripts/mock.gen.sh
- shell: bash
run: .github/workflows/check-clean-branch.sh
go_mod_tidy:
name: Up-to-date go.mod and go.sum
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- shell: bash
run: go mod tidy
- shell: bash
run: .github/workflows/check-clean-branch.sh
test_build_image:
name: Image build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install qemu (required for cross-platform builds)
run: |
sudo apt update
sudo apt -y install qemu qemu-user-static
- name: Check image build
shell: bash
run: bash -x scripts/tests.build_image.sh
test_build_antithesis_avalanchego_images:
name: Build Antithesis avalanchego images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check image build for avalanchego test setup
shell: bash
run: bash -x scripts/tests.build_antithesis_images.sh
env:
TEST_SETUP: avalanchego
test_build_antithesis_xsvm_images:
name: Build Antithesis xsvm images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check image build for xsvm test setup
shell: bash
run: bash -x scripts/tests.build_antithesis_images.sh
env:
TEST_SETUP: xsvm