From c5fda85ef027d7b523604486e9e59fa7280929d4 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 23 Apr 2021 12:54:23 -0400 Subject: [PATCH] Key CI cache on build profile (#10333) We are aware that "lint debug ubuntu" and "test debug ubuntu" are sharing caches - and that it is not ideal. Likely the lint cache will be written first, and test-debug will have to build extra. However neither are the bottleneck now. We proceed on the assumption that we're hitting the 5 GB cache limit on a single PR, inducing a forever-rolling behavior. If "test debug ubuntu" becomes the bottleneck in the future we will revisit. --- .github/workflows/ci.yml | 70 +++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc2de6d434..6afa9e657d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: build: - name: ${{ matrix.kind }} ${{ matrix.os }} + name: ${{ matrix.kind }} ${{ matrix.profile }} ${{ matrix.os }} if: | github.event_name == 'push' || !startsWith(github.event.pull_request.head.label, 'denoland:') @@ -13,22 +13,29 @@ jobs: strategy: matrix: include: + # TODO(ry) Rename 'kind' to 'job'? - os: macos-10.15 - kind: test_release + kind: test + profile: release - os: windows-2019 - kind: test_release + kind: test + profile: release - os: ${{ github.repository == 'denoland/deno' && 'ubuntu-latest-xl' || 'ubuntu-latest' }} kind: bench + profile: release - os: ${{ github.repository == 'denoland/deno' && 'ubuntu-latest-xl' || 'ubuntu-latest' }} kind: lint + profile: debug - os: ${{ github.repository == 'denoland/deno' && 'ubuntu-latest-xl' || 'ubuntu-latest' }} - kind: test_debug + kind: test + profile: debug # Warning: Do not upgrade test_release to newer version of ubuntu # runners. We need to link against older version of glibc in order to # run on older systems. glibc in 20.04 is not compatible with 18.04. # See #9484. - os: ubuntu-18.04 - kind: test_release + kind: test + profile: release # Always run main branch builds to completion. This allows the cache to # stay mostly up-to-date in situations where a single job fails due to @@ -58,7 +65,8 @@ jobs: - name: Create source tarballs (release, linux) if: | startsWith(matrix.os, 'ubuntu') && - matrix.kind == 'test_release' && + matrix.profile == 'release' && + matrix.kind == 'test' && github.repository == 'denoland/deno' && startsWith(github.ref, 'refs/tags/') run: | @@ -112,7 +120,8 @@ jobs: - name: Setup gcloud (unix) if: | runner.os != 'Windows' && - matrix.kind == 'test_release' && + matrix.profile == 'release' && + matrix.kind == 'test' && github.repository == 'denoland/deno' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) @@ -125,7 +134,8 @@ jobs: - name: Setup gcloud (windows) if: | runner.os == 'Windows' && - matrix.kind == 'test_release' && + matrix.kind == 'test' && + matrix.profile == 'release' && github.repository == 'denoland/deno' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) @@ -139,7 +149,8 @@ jobs: - name: Configure canary build if: | - matrix.kind == 'test_release' && + matrix.kind == 'test' && + matrix.profile == 'release' && github.repository == 'denoland/deno' && github.ref == 'refs/heads/main' shell: bash @@ -179,7 +190,7 @@ jobs: path: | ./target key: - d-${{ matrix.os }}-${{ matrix.kind }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('Cargo.lock') }} + a-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ hashFiles('Cargo.lock') }} - name: Apply and update mtime cache uses: ./.github/mtime_cache @@ -192,22 +203,22 @@ jobs: - name: lint.js if: matrix.kind == 'lint' + # TODO(ry) assert matrix.profile == "debug" run: deno run --unstable --allow-write --allow-read --allow-run ./tools/lint.js - name: Build release - if: | - matrix.kind == 'test_release' || - matrix.kind == 'bench' + if: (matrix.kind == 'test' || matrix.kind == 'bench') && matrix.profile == 'release' run: cargo build --release --locked --all-targets -vv - name: Build debug - if: matrix.kind == 'test_debug' + if: (matrix.kind == 'test' || matrix.kind == 'bench') && matrix.profile == 'debug' run: cargo build --locked --all-targets - name: Pre-release (linux) if: | startsWith(matrix.os, 'ubuntu') && - matrix.kind == 'test_release' + matrix.kind == 'test' && + matrix.profile == 'release' run: | cd target/release zip -r deno-x86_64-unknown-linux-gnu.zip deno @@ -217,7 +228,8 @@ jobs: - name: Pre-release (mac) if: | startsWith(matrix.os, 'macOS') && - matrix.kind == 'test_release' + matrix.kind == 'test' && + matrix.profile == 'release' run: | cd target/release zip -r deno-x86_64-apple-darwin.zip deno @@ -226,7 +238,8 @@ jobs: - name: Pre-release (windows) if: | startsWith(matrix.os, 'windows') && - matrix.kind == 'test_release' + matrix.kind == 'test' && + matrix.profile == 'release' run: | Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-x86_64-pc-windows-msvc.zip Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.exe -DestinationPath target/release/denort-x86_64-pc-windows-msvc.zip @@ -234,7 +247,8 @@ jobs: - name: Upload canary to dl.deno.land (unix) if: | runner.os != 'Windows' && - matrix.kind == 'test_release' && + matrix.kind == 'test' && + matrix.profile == 'release' && github.repository == 'denoland/deno' && github.ref == 'refs/heads/main' run: | @@ -245,7 +259,8 @@ jobs: - name: Upload canary to dl.deno.land (windows) if: | runner.os == 'Windows' && - matrix.kind == 'test_release' && + matrix.kind == 'test' && + matrix.profile == 'release' && github.repository == 'denoland/deno' && github.ref == 'refs/heads/main' env: @@ -257,11 +272,11 @@ jobs: gsutil cp canary-latest.txt gs://dl.deno.land/canary-latest.txt - name: Test release - if: matrix.kind == 'test_release' + if: matrix.kind == 'test' && matrix.profile == 'release' run: cargo test --release --locked --all-targets - name: Test debug - if: matrix.kind == 'test_debug' + if: matrix.kind == 'test' && matrix.profile == 'debug' run: | cargo test --locked --doc cargo test --locked --all-targets @@ -277,13 +292,13 @@ jobs: run: python wpt make-hosts-file | Out-File $env:SystemRoot\System32\drivers\etc\hosts -Encoding ascii -Append - name: Run web platform tests (release) - if: matrix.kind == 'test_release' + if: matrix.kind == 'test' && matrix.profile == 'release' run: | deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts setup deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts run --quiet --release - name: Run web platform tests (debug) - if: matrix.kind == 'test_debug' + if: matrix.kind == 'test' && matrix.profile == 'debug' run: | deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts setup deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts run --quiet @@ -318,7 +333,8 @@ jobs: - name: Upload release to dl.deno.land (unix) if: | runner.os != 'Windows' && - matrix.kind == 'test_release' && + matrix.kind == 'test' && + matrix.profile == 'release' && github.repository == 'denoland/deno' && startsWith(github.ref, 'refs/tags/') run: | @@ -329,7 +345,8 @@ jobs: - name: Upload release to dl.deno.land (windows) if: | runner.os == 'Windows' && - matrix.kind == 'test_release' && + matrix.kind == 'test' && + matrix.profile == 'release' && github.repository == 'denoland/deno' && startsWith(github.ref, 'refs/tags/') env: @@ -343,7 +360,8 @@ jobs: - name: Upload release to GitHub uses: softprops/action-gh-release@v1 if: | - matrix.kind == 'test_release' && + matrix.kind == 'test' && + matrix.profile == 'release' && github.repository == 'denoland/deno' && startsWith(github.ref, 'refs/tags/') env: