github.com/MetalBlockchain/metalgo@v1.11.9/.github/workflows/ci.yml (about) 1 name: Tests 2 3 on: 4 push: 5 tags: 6 - "*" 7 branches: 8 - master 9 - dev 10 pull_request: 11 merge_group: 12 types: [checks_requested] 13 14 permissions: 15 contents: read 16 17 # Cancel ongoing workflow runs if a new one is started 18 concurrency: 19 group: ${{ github.workflow }}-${{ github.ref }} 20 cancel-in-progress: true 21 22 env: 23 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 }} 24 25 jobs: 26 Unit: 27 runs-on: ${{ matrix.os }} 28 strategy: 29 fail-fast: false 30 matrix: 31 os: [macos-12, ubuntu-20.04, ubuntu-22.04, windows-2022, custom-arm64-focal, custom-arm64-jammy] 32 steps: 33 - uses: actions/checkout@v4 34 - uses: ./.github/actions/install-focal-deps 35 if: matrix.os == 'custom-arm64-focal' 36 - uses: ./.github/actions/setup-go-for-project-v3 37 - name: Set timeout on Windows # Windows UT run slower and need a longer timeout 38 shell: bash 39 if: matrix.os == 'windows-2022' 40 run: echo "TIMEOUT=240s" >> "$GITHUB_ENV" 41 - name: build_test 42 shell: bash 43 run: ./scripts/build_test.sh 44 env: 45 TIMEOUT: ${{ env.TIMEOUT }} 46 Fuzz: 47 runs-on: ubuntu-22.04 48 steps: 49 - uses: actions/checkout@v4 50 - uses: ./.github/actions/setup-go-for-project 51 - name: fuzz_test 52 shell: bash 53 run: ./scripts/build_fuzz.sh 10 # Run each fuzz test 10 seconds 54 e2e: 55 runs-on: ubuntu-latest 56 steps: 57 - uses: actions/checkout@v4 58 - uses: ./.github/actions/setup-go-for-project 59 - name: Build AvalancheGo Binary 60 shell: bash 61 run: ./scripts/build.sh -r 62 - name: Start prometheus 63 # Only run for the original repo; a forked repo won't have access to the monitoring credentials 64 if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) 65 shell: bash 66 run: bash -x ./scripts/run_prometheus.sh 67 env: 68 PROMETHEUS_ID: ${{ secrets.PROMETHEUS_ID }} 69 PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }} 70 - name: Start promtail 71 if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) 72 shell: bash 73 run: bash -x ./scripts/run_promtail.sh 74 env: 75 LOKI_ID: ${{ secrets.LOKI_ID }} 76 LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }} 77 - name: Notify of metrics availability 78 if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) 79 shell: bash 80 run: .github/workflows/notify-metrics-availability.sh 81 env: 82 GRAFANA_URL: ${{ env.grafana_url }} 83 GH_JOB_ID: ${{ github.job }} 84 FILTER_BY_OWNER: avalanchego-e2e 85 - name: Run e2e tests 86 shell: bash 87 run: E2E_SERIAL=1 ./scripts/tests.e2e.sh --delay-network-shutdown 88 env: 89 GH_REPO: ${{ github.repository }} 90 GH_WORKFLOW: ${{ github.workflow }} 91 GH_RUN_ID: ${{ github.run_id }} 92 GH_RUN_NUMBER: ${{ github.run_number }} 93 GH_RUN_ATTEMPT: ${{ github.run_attempt }} 94 GH_JOB_ID: ${{ github.job }} 95 - name: Upload tmpnet network dir 96 uses: actions/upload-artifact@v4 97 if: always() 98 with: 99 name: e2e-tmpnet-data 100 path: | 101 ~/.tmpnet/networks 102 ~/.tmpnet/prometheus/prometheus.log 103 ~/.tmpnet/promtail/promtail.log 104 if-no-files-found: error 105 e2e_existing_network: 106 runs-on: ubuntu-latest 107 steps: 108 - uses: actions/checkout@v4 109 - uses: ./.github/actions/setup-go-for-project 110 - name: Build AvalancheGo Binary 111 shell: bash 112 run: ./scripts/build.sh -r 113 - name: Start prometheus 114 # Only run for the original repo; a forked repo won't have access to the monitoring credentials 115 if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) 116 shell: bash 117 run: bash -x ./scripts/run_prometheus.sh 118 env: 119 PROMETHEUS_ID: ${{ secrets.PROMETHEUS_ID }} 120 PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }} 121 - name: Start promtail 122 if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) 123 shell: bash 124 run: bash -x ./scripts/run_promtail.sh 125 env: 126 LOKI_ID: ${{ secrets.LOKI_ID }} 127 LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }} 128 - name: Notify of metrics availability 129 if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) 130 shell: bash 131 run: .github/workflows/notify-metrics-availability.sh 132 env: 133 GRAFANA_URL: ${{ env.grafana_url }} 134 GH_JOB_ID: ${{ github.job }} 135 - name: Run e2e tests with existing network 136 shell: bash 137 run: E2E_SERIAL=1 ./scripts/tests.e2e.existing.sh --delay-network-shutdown 138 env: 139 GH_REPO: ${{ github.repository }} 140 GH_WORKFLOW: ${{ github.workflow }} 141 GH_RUN_ID: ${{ github.run_id }} 142 GH_RUN_NUMBER: ${{ github.run_number }} 143 GH_RUN_ATTEMPT: ${{ github.run_attempt }} 144 GH_JOB_ID: ${{ github.job }} 145 - name: Upload tmpnet network dir 146 uses: actions/upload-artifact@v4 147 if: always() 148 with: 149 name: e2e-existing-network-tmpnet-data 150 path: | 151 ~/.tmpnet/networks 152 ~/.tmpnet/prometheus/prometheus.log 153 ~/.tmpnet/promtail/promtail.log 154 if-no-files-found: error 155 Upgrade: 156 runs-on: ubuntu-latest 157 steps: 158 - uses: actions/checkout@v4 159 - uses: ./.github/actions/setup-go-for-project 160 - name: Build AvalancheGo Binary 161 shell: bash 162 run: ./scripts/build.sh 163 - name: Start prometheus 164 # Only run for the original repo; a forked repo won't have access to the monitoring credentials 165 if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) 166 shell: bash 167 run: bash -x ./scripts/run_prometheus.sh 168 env: 169 PROMETHEUS_ID: ${{ secrets.PROMETHEUS_ID }} 170 PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }} 171 - name: Start promtail 172 if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) 173 shell: bash 174 run: bash -x ./scripts/run_promtail.sh 175 env: 176 LOKI_ID: ${{ secrets.LOKI_ID }} 177 LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }} 178 - name: Notify of metrics availability 179 if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository) 180 shell: bash 181 run: .github/workflows/notify-metrics-availability.sh 182 env: 183 GRAFANA_URL: ${{ env.grafana_url }} 184 GH_JOB_ID: ${{ github.job }} 185 - name: Run e2e tests 186 shell: bash 187 run: ./scripts/tests.upgrade.sh 188 env: 189 GH_REPO: ${{ github.repository }} 190 GH_WORKFLOW: ${{ github.workflow }} 191 GH_RUN_ID: ${{ github.run_id }} 192 GH_RUN_NUMBER: ${{ github.run_number }} 193 GH_RUN_ATTEMPT: ${{ github.run_attempt }} 194 GH_JOB_ID: ${{ github.job }} 195 - name: Upload tmpnet network dir 196 uses: actions/upload-artifact@v4 197 if: always() 198 with: 199 name: upgrade-tmpnet-data 200 path: | 201 ~/.tmpnet/networks 202 ~/.tmpnet/prometheus/prometheus.log 203 ~/.tmpnet/promtail/promtail.log 204 if-no-files-found: error 205 Lint: 206 runs-on: ubuntu-latest 207 steps: 208 - uses: actions/checkout@v4 209 - uses: ./.github/actions/setup-go-for-project 210 - name: Run static analysis tests 211 shell: bash 212 run: scripts/lint.sh 213 - name: Run shellcheck 214 shell: bash 215 run: scripts/shellcheck.sh 216 - name: Run actionlint 217 shell: bash 218 run: scripts/actionlint.sh 219 buf-lint: 220 name: Protobuf Lint 221 runs-on: ubuntu-latest 222 steps: 223 - uses: actions/checkout@v4 224 - uses: bufbuild/buf-setup-action@v1.31.0 225 with: 226 github_token: ${{ github.token }} 227 - uses: bufbuild/buf-lint-action@v1 228 with: 229 input: "proto" 230 check_generated_protobuf: 231 name: Up-to-date protobuf 232 runs-on: ubuntu-latest 233 steps: 234 - uses: actions/checkout@v4 235 - uses: ./.github/actions/setup-go-for-project 236 - uses: bufbuild/buf-setup-action@v1.31.0 237 - shell: bash 238 run: scripts/protobuf_codegen.sh 239 - shell: bash 240 run: .github/workflows/check-clean-branch.sh 241 check_mockgen: 242 name: Up-to-date mocks 243 runs-on: ubuntu-latest 244 steps: 245 - uses: actions/checkout@v4 246 - uses: ./.github/actions/setup-go-for-project 247 - shell: bash 248 run: scripts/mock.gen.sh 249 - shell: bash 250 run: .github/workflows/check-clean-branch.sh 251 go_mod_tidy: 252 name: Up-to-date go.mod and go.sum 253 runs-on: ubuntu-latest 254 steps: 255 - uses: actions/checkout@v4 256 - uses: ./.github/actions/setup-go-for-project 257 - shell: bash 258 run: go mod tidy 259 - shell: bash 260 run: .github/workflows/check-clean-branch.sh 261 test_build_image: 262 name: Image build 263 runs-on: ubuntu-latest 264 steps: 265 - uses: actions/checkout@v4 266 - name: Install qemu (required for cross-platform builds) 267 run: | 268 sudo apt update 269 sudo apt -y install qemu qemu-user-static 270 - name: Check image build 271 shell: bash 272 run: bash -x scripts/tests.build_image.sh 273 test_build_antithesis_avalanchego_images: 274 name: Build Antithesis avalanchego images 275 runs-on: ubuntu-latest 276 steps: 277 - uses: actions/checkout@v4 278 - name: Check image build for avalanchego test setup 279 shell: bash 280 run: bash -x scripts/tests.build_antithesis_images.sh 281 env: 282 TEST_SETUP: avalanchego 283 test_build_antithesis_xsvm_images: 284 name: Build Antithesis xsvm images 285 runs-on: ubuntu-latest 286 steps: 287 - uses: actions/checkout@v4 288 - name: Check image build for xsvm test setup 289 shell: bash 290 run: bash -x scripts/tests.build_antithesis_images.sh 291 env: 292 TEST_SETUP: xsvm