Skip to content

Commit

Permalink
Optimize github cache usage, remove sccache (denoland#4452)
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Mar 21, 2020
1 parent 60cee4f commit b191c91
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 64 deletions.
94 changes: 31 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ jobs:
- os: macOS-latest
kind: 'test_debug'

# Always run master branch builds to completion. This allows the cache to
# stay mostly up-to-date in situations where a single job fails due to
# e.g. a flaky test.
fail-fast:
${{ github.event_name != 'push' || github.ref != 'refs/heads/master' }}

env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
V8_BINARY: true

steps:
Expand All @@ -49,24 +55,7 @@ jobs:
if: startsWith(matrix.os, 'ubuntu') && matrix.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') && github.repository == 'denoland/deno'
run: |
mkdir -p target/release
tar --exclude=".git*" --exclude=target --exclude=deno_typescript/typescript/tests --exclude=third_party/cpplint --exclude=third_party/node_modules --exclude=third_party/python_packages --exclude=third_party/prebuilt -czvf target/release/deno_src.tar.gz -C .. deno
# Cache https://github.com/actions/cache/blob/master/examples.md#rust---cargo
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
tar --exclude=.cargo --exclude=".git*" --exclude=target --exclude=deno_typescript/typescript/tests --exclude=third_party/cpplint --exclude=third_party/node_modules --exclude=third_party/python_packages --exclude=third_party/prebuilt -czvf target/release/deno_src.tar.gz -C .. deno
- name: Install rust
uses: hecrj/setup-rust-action@v1
Expand All @@ -93,54 +82,36 @@ jobs:
Select-Object -Skip 1 |
ForEach-Object { Move-Item "$_" "$_.disabled" }
- name: Environment (linux)
if: startsWith(matrix.os, 'ubuntu')
# In order to test the installer scripts in std we need a deno
# executable in the path. See
# https://github.com/denoland/deno/blob/27cd2c97f18c0392bc04c66b786717b2bc677315/std/installer/mod.ts#L185-L193
# TODO(ry) This path modification should rather be done in "cargo test".
run: |
echo ::add-path::`pwd`/third_party/prebuilt/linux64
echo ::add-path::`pwd`/target/release
- name: Environment (mac)
if: startsWith(matrix.os, 'macOS')
run: |
echo ::add-path::`pwd`/third_party/prebuilt/mac
echo ::add-path::`pwd`/target/release
- name: Environment (windows)
if: startsWith(matrix.os, 'windows')
run: |
echo ::add-path::$(pwd)\third_party\prebuilt\win
echo ::add-path::$(pwd)\target\release
- name: Log versions
run: |
node -v
python --version
rustc --version
cargo --version
- name: Start sccache (azure)
if: startsWith(matrix.os, 'windows') == false
env:
SCCACHE_AZURE_BLOB_CONTAINER: deno-sccache2
SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING || 'DefaultEndpointsProtocol=https;AccountName=denosccache;EndpointSuffix=core.windows.net' }}
SCCACHE_IDLE_TIMEOUT: 0
run: sccache --start-server

# TODO(ry) We want to use Azure because it's cheaper. However sccache on
# Windows has a bug when using Azure. The bug manifests itself as a
# "multiple input files" error message.
- name: Start sccache (s3)
if: startsWith(matrix.os, 'windows')
env:
AWS_ACCESS_KEY_ID: AKIAIVRN52PLDBP55LBQ
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SCCACHE_BUCKET: deno-sccache
SCCACHE_IDLE_TIMEOUT: 0
run: sccache --start-server
- name: Configure cargo data directory
# After this point, all cargo registry and crate data is stored in
# $GITHUB_WORKSPACE/.cargo. This allows us to cache only the files that
# are needed during the build process. Additionally, this works around
# a bug in the 'cache' action that causes directories outside of the
# workspace dir to be saved/restored incorrectly.
run: echo "::set-env name=CARGO_HOME::$(pwd)/.cargo"

- name: Cache
uses: actions/cache@master
with:
# Note: crates from the denoland/deno git repo always get rebuilt,
# and their outputs ('deno', 'libdeno.rlib' etc.) are quite big,
# so we cache only those subdirectories of target/{debug|release} that
# contain the build output for crates that come from the registry.
path: |-
.cargo
target/*/.*
target/*/build
target/*/deps
target/*/gn_out
key:
${{ matrix.os }}-${{ matrix.kind }}-${{ hashFiles('Cargo.lock') }}

- name: lint.py
if: matrix.kind == 'lint'
Expand Down Expand Up @@ -232,6 +203,3 @@ jobs:
cd ../cli
sleep 30
cargo publish
- name: Stop sccache
run: sccache --stop-server
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.pyc
*.swp

/.cargo/
/.idea/
/.vscode/
gclient_config.py_entries
Expand Down
2 changes: 1 addition & 1 deletion third_party

0 comments on commit b191c91

Please sign in to comment.