github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/.github/workflows/ci.yml (about) 1 name: CI 2 3 on: 4 push: 5 branches: 6 - 'auto-cadence-upgrade/**' 7 - staging 8 - trying 9 - 'feature/**' 10 - 'v[0-9]+.[0-9]+' 11 pull_request: 12 branches: 13 - master* 14 - 'auto-cadence-upgrade/**' 15 - 'feature/**' 16 - 'v[0-9]+.[0-9]+' 17 merge_group: 18 branches: 19 - master 20 21 env: 22 GO_VERSION: "1.20" 23 24 concurrency: 25 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} 26 cancel-in-progress: true 27 28 jobs: 29 golangci: 30 strategy: 31 fail-fast: false 32 matrix: 33 dir: [./, ./integration/, ./insecure/] 34 name: Lint 35 runs-on: ubuntu-latest 36 steps: 37 - name: Checkout repo 38 uses: actions/checkout@v3 39 - name: Setup Go 40 uses: actions/setup-go@v4 41 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 42 with: 43 go-version: ${{ env.GO_VERSION }} 44 cache: true 45 - name: Run go generate 46 run: go generate 47 working-directory: ${{ matrix.dir }} 48 - name: Run golangci-lint 49 uses: golangci/golangci-lint-action@v3 50 with: 51 # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. 52 version: v1.54 53 args: -v 54 working-directory: ${{ matrix.dir }} 55 # https://github.com/golangci/golangci-lint-action/issues/244 56 skip-cache: true 57 58 59 tidy: 60 name: Tidy 61 runs-on: ubuntu-latest 62 steps: 63 - name: Checkout repo 64 uses: actions/checkout@v3 65 - name: Setup Go 66 uses: actions/setup-go@v4 67 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 68 with: 69 go-version: ${{ env.GO_VERSION }} 70 cache: true 71 - name: Run tidy 72 run: make tidy 73 - name: code sanity check 74 run: make code-sanity-check 75 76 create-dynamic-test-matrix: 77 name: Create Dynamic Test Matrix 78 runs-on: ubuntu-latest 79 outputs: 80 dynamic-matrix: ${{ steps.set-test-matrix.outputs.dynamicMatrix }} 81 steps: 82 - name: Checkout repo 83 uses: actions/checkout@v3 84 - name: Setup Go 85 uses: actions/setup-go@v4 86 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 87 with: 88 go-version: ${{ env.GO_VERSION }} 89 cache: true 90 - name: Set Test Matrix 91 id: set-test-matrix 92 run: go run tools/test_matrix_generator/matrix.go 93 94 create-insecure-dynamic-test-matrix: 95 name: Create Dynamic Unit Test Insecure Package Matrix 96 runs-on: ubuntu-latest 97 outputs: 98 dynamic-matrix: ${{ steps.set-test-matrix.outputs.dynamicMatrix }} 99 steps: 100 - name: Checkout repo 101 uses: actions/checkout@v3 102 - name: Setup Go 103 uses: actions/setup-go@v4 104 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 105 with: 106 go-version: ${{ env.GO_VERSION }} 107 cache: true 108 - name: Set Test Matrix 109 id: set-test-matrix 110 run: go run tools/test_matrix_generator/matrix.go -c insecure 111 112 create-integration-dynamic-test-matrix: 113 name: Create Dynamic Integration Test Package Matrix 114 runs-on: ubuntu-latest 115 outputs: 116 dynamic-matrix: ${{ steps.set-test-matrix.outputs.dynamicMatrix }} 117 steps: 118 - name: Checkout repo 119 uses: actions/checkout@v3 120 - name: Setup Go 121 uses: actions/setup-go@v4 122 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 123 with: 124 go-version: ${{ env.GO_VERSION }} 125 cache: true 126 - name: Set Test Matrix 127 id: set-test-matrix 128 run: go run tools/test_matrix_generator/matrix.go -c integration 129 130 unit-test: 131 name: Unit Tests (${{ matrix.targets.name }}) 132 needs: create-dynamic-test-matrix 133 strategy: 134 fail-fast: false 135 matrix: 136 targets: ${{ fromJSON(needs.create-dynamic-test-matrix.outputs.dynamic-matrix)}} 137 ## need to set image explicitly due to GitHub logging issue as described in https://github.com/onflow/flow-go/pull/3087#issuecomment-1234383202 138 runs-on: ${{ matrix.targets.runner }} 139 steps: 140 - name: Checkout repo 141 uses: actions/checkout@v3 142 - name: Setup Go 143 uses: actions/setup-go@v4 144 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 145 with: 146 go-version: ${{ env.GO_VERSION }} 147 cache: true 148 - name: Setup tests (${{ matrix.targets.name }}) 149 run: VERBOSE=1 make -e GO_TEST_PACKAGES="${{ matrix.targets.packages }}" install-tools 150 - name: Run tests (${{ matrix.targets.name }}) 151 uses: nick-fields/retry@v2 152 with: 153 timeout_minutes: 35 154 max_attempts: 5 155 command: VERBOSE=1 make -e GO_TEST_PACKAGES="${{ matrix.targets.packages }}" test 156 # TODO(rbtz): re-enable when we fix exisiting races. 157 #env: 158 # RACE_DETECTOR: 1 159 - name: Upload coverage report 160 uses: codecov/codecov-action@v4 161 timeout-minutes: 1 162 continue-on-error: true 163 with: 164 file: ./coverage.txt 165 flags: unittests 166 name: codecov-umbrella 167 token: ${{ secrets.CODECOV_TOKEN }} 168 169 unit-test-insecure: 170 name: Unit Tests Insecure (${{ matrix.targets.name }}) 171 needs: create-insecure-dynamic-test-matrix 172 strategy: 173 fail-fast: false 174 matrix: 175 targets: ${{ fromJSON(needs.create-insecure-dynamic-test-matrix.outputs.dynamic-matrix)}} 176 ## need to set image explicitly due to GitHub logging issue as described in https://github.com/onflow/flow-go/pull/3087#issuecomment-1234383202 177 runs-on: ${{ matrix.targets.runner }} 178 steps: 179 - name: Checkout repo 180 uses: actions/checkout@v3 181 - name: Setup Go 182 uses: actions/setup-go@v4 183 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 184 with: 185 go-version: ${{ env.GO_VERSION }} 186 cache: true 187 - name: Setup tests (${{ matrix.targets.name }}) 188 run: VERBOSE=1 make -e GO_TEST_PACKAGES="${{ matrix.targets.packages }}" install-tools 189 - name: Run tests (${{ matrix.targets.name }}) 190 uses: nick-fields/retry@v2 191 with: 192 timeout_minutes: 35 193 max_attempts: 5 194 command: VERBOSE=1 make -C ./insecure -e GO_TEST_PACKAGES="${{ matrix.targets.packages }}" test 195 # TODO(rbtz): re-enable when we fix exisiting races. 196 #env: 197 # RACE_DETECTOR: 1 198 - name: Upload coverage report 199 uses: codecov/codecov-action@v4 200 timeout-minutes: 1 201 continue-on-error: true 202 with: 203 file: ./coverage.txt 204 flags: unittests 205 name: codecov-umbrella 206 token: ${{ secrets.CODECOV_TOKEN }} 207 208 docker-build: 209 name: Docker Build 210 runs-on: buildjet-16vcpu-ubuntu-2204 211 env: 212 CADENCE_DEPLOY_KEY: ${{ secrets.CADENCE_DEPLOY_KEY }} 213 steps: 214 - name: Checkout repo 215 uses: actions/checkout@v3 216 with: 217 # all tags are needed for integration tests 218 fetch-depth: 0 219 - name: Setup Go 220 uses: actions/setup-go@v4 221 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 222 with: 223 go-version: ${{ env.GO_VERSION }} 224 cache: true 225 - name: Docker build 226 env: 227 CADENCE_DEPLOY_KEY: ${{ secrets.CADENCE_DEPLOY_KEY }} 228 run: make docker-native-build-flow docker-native-build-flow-corrupt 229 - name: Save Docker images 230 run: | 231 docker save \ 232 gcr.io/flow-container-registry/access:latest \ 233 gcr.io/flow-container-registry/collection:latest \ 234 gcr.io/flow-container-registry/consensus:latest \ 235 gcr.io/flow-container-registry/execution:latest \ 236 gcr.io/flow-container-registry/ghost:latest \ 237 gcr.io/flow-container-registry/observer:latest \ 238 gcr.io/flow-container-registry/verification:latest \ 239 gcr.io/flow-container-registry/access-corrupted:latest \ 240 gcr.io/flow-container-registry/execution-corrupted:latest \ 241 gcr.io/flow-container-registry/verification-corrupted:latest > flow-docker-images.tar 242 - name: Cache Docker images 243 uses: actions/cache@v3 244 with: 245 path: flow-docker-images.tar 246 # use the workflow run id as part of the cache key to ensure these docker images will only be used for a single workflow run 247 key: flow-docker-images-${{ hashFiles('**/Dockerfile') }}-${{ github.run_id }} 248 249 integration-test-others: 250 name: Integration Tests Others (${{ matrix.targets.name }}) 251 needs: create-integration-dynamic-test-matrix 252 strategy: 253 fail-fast: false 254 matrix: 255 targets: ${{ fromJSON(needs.create-integration-dynamic-test-matrix.outputs.dynamic-matrix)}} 256 ## need to set image explicitly due to GitHub logging issue as described in https://github.com/onflow/flow-go/pull/3087#issuecomment-1234383202 257 runs-on: ${{ matrix.targets.runner }} 258 steps: 259 - name: Checkout repo 260 uses: actions/checkout@v3 261 - name: Setup Go 262 uses: actions/setup-go@v4 263 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 264 with: 265 go-version: ${{ env.GO_VERSION }} 266 cache: true 267 - name: Setup tests (${{ matrix.targets.name }}) 268 run: VERBOSE=1 make -e GO_TEST_PACKAGES="${{ matrix.targets.packages }}" install-tools 269 - name: Run tests (${{ matrix.targets.name }}) 270 uses: nick-fields/retry@v2 271 with: 272 timeout_minutes: 35 273 max_attempts: 5 274 command: VERBOSE=1 make -C ./integration -e GO_TEST_PACKAGES="${{ matrix.targets.packages }}" test 275 # TODO(rbtz): re-enable when we fix exisiting races. 276 #env: 277 # RACE_DETECTOR: 1 278 - name: Upload coverage report 279 uses: codecov/codecov-action@v4 280 timeout-minutes: 1 281 continue-on-error: true 282 with: 283 file: ./coverage.txt 284 flags: unittests 285 name: codecov-umbrella 286 token: ${{ secrets.CODECOV_TOKEN }} 287 288 integration-test: 289 name: Integration Tests 290 needs: docker-build 291 strategy: 292 fail-fast: false 293 matrix: 294 include: 295 - name: Access Cohort1 Integration Tests 296 make: make -C integration access-cohort1-tests 297 runner: buildjet-4vcpu-ubuntu-2204 298 - name: Access Cohort2 Integration Tests 299 make: make -C integration access-cohort2-tests 300 runner: ubuntu-latest 301 - name: Access Cohort3 Integration Tests 302 make: make -C integration access-cohort3-tests 303 runner: ubuntu-latest 304 # test suite has single test which is flaky and needs to be fixed - reminder here to put it back when it's fixed 305 # - name: BFT (Framework) Integration Tests 306 # make: make -C integration bft-framework-tests 307 # runner: ubuntu-latest 308 - name: BFT (Protocol) Integration Tests 309 make: make -C integration bft-protocol-tests 310 runner: buildjet-8vcpu-ubuntu-2204 311 - name: BFT (Gossipsub) Integration Tests 312 make: make -C integration bft-gossipsub-tests 313 runner: ubuntu-latest 314 - name: Collection Integration Tests 315 make: make -C integration collection-tests 316 runner: ubuntu-latest 317 - name: Consensus Integration Tests 318 make: make -C integration consensus-tests 319 runner: ubuntu-latest 320 - name: Epoch Cohort1 Integration Tests 321 make: make -C integration epochs-cohort1-tests 322 runner: buildjet-8vcpu-ubuntu-2204 323 - name: Epoch Cohort2 Integration Tests 324 make: make -C integration epochs-cohort2-tests 325 runner: buildjet-4vcpu-ubuntu-2204 326 - name: Execution Integration Tests 327 make: make -C integration execution-tests 328 runner: ubuntu-latest 329 - name: Ghost Integration Tests 330 make: make -C integration ghost-tests 331 runner: ubuntu-latest 332 - name: MVP Integration Tests 333 make: make -C integration mvp-tests 334 runner: ubuntu-latest 335 - name: Network Integration Tests 336 make: make -C integration network-tests 337 runner: ubuntu-latest 338 - name: Verification Integration Tests 339 make: make -C integration verification-tests 340 runner: ubuntu-latest 341 - name: Upgrade Integration Tests 342 make: make -C integration upgrades-tests 343 runner: ubuntu-latest 344 runs-on: ${{ matrix.runner }} 345 steps: 346 - name: Checkout repo 347 uses: actions/checkout@v3 348 with: 349 # all tags are needed for integration tests 350 fetch-depth: 0 351 - name: Setup Go 352 uses: actions/setup-go@v4 353 timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time 354 with: 355 go-version: ${{ env.GO_VERSION }} 356 cache: true 357 - name: Load cached Docker images 358 uses: actions/cache@v3 359 with: 360 path: flow-docker-images.tar 361 # use the same cache key as the docker-build job 362 key: flow-docker-images-${{ hashFiles('**/Dockerfile') }}-${{ github.run_id }} 363 - name: Load Docker images 364 run: docker load -i flow-docker-images.tar 365 - name: Run tests (${{ matrix.name }}) 366 # TODO(rbtz): re-enable when we fix exisiting races. 367 #env: 368 # RACE_DETECTOR: 1 369 uses: nick-fields/retry@v2 370 with: 371 timeout_minutes: 35 372 max_attempts: 5 373 command: VERBOSE=1 ${{ matrix.make }}