Skip to content

Commit

Permalink
chore(CI): try sccache
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5459 committed Dec 9, 2022
1 parent 606c537 commit 88e604f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 18 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/venus-worker-util.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [ main, release/**, dev/coop/** ]

# push:
# branches: [ main, release/** ]
# branches: [ main, release/**, dev/coop/** ]

jobs:
build:
Expand All @@ -24,18 +24,6 @@ jobs:
override: true
components: rustfmt, clippy

- name: setup build cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
venus-worker/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('venus-worker-util/Cargo.lock') }}

- name: test venus-worker-util
run: make test-worker-util

Expand Down
44 changes: 39 additions & 5 deletions .github/workflows/venus-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,42 @@ on:
pull_request:
branches: [ main, release/**, dev/coop/** ]

# push:
# branches: [ main, release/** ]
push:
branches: [ main, release/**, dev/coop/** ]

jobs:
build:
runs-on: ubuntu-20.04
env:
RUSTC_WRAPPER: sccache

steps:
- uses: actions/checkout@v2

- name: dependencies
run: sudo apt update && sudo apt install --reinstall ocl-icd-opencl-dev libhwloc-dev -y


- name: install sccache
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: 0.3.3
run: |
SCCACHE_FILE=sccache-v$SCCACHE_VERSION-$(arch)-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/v$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
rm -rf $SCCACHE_FILE $SCCACHE_FILE.tar.gz
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: '1.60.0'
override: true
components: rustfmt, clippy

- name: setup build cache
- name: setup cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
Expand All @@ -34,7 +49,23 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
venus-worker/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('venus-worker/Cargo.lock') }}
key: venus-worker-${{ runner.os }}-cargo-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('venus-worker/Cargo.lock') }}
restore-keys: |
venus-worker-${{ runner.os }}-cargo-${{ hashFiles('rust-toolchain') }}-
venus-worker-${{ runner.os }}-cargo-
- name: Configure sccache
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: start sccache server
run: sccache --start-server
env:
SCCACHE_GHA_CACHE_FROM: ${{ runner.os }}-sccache-
SCCACHE_GHA_CACHE_TO: ${{ runner.os }}-sccache-latest

- name: test venus-worker
run: make test-worker
Expand All @@ -51,6 +82,9 @@ jobs:
- name: show bins
run: ls -lha ./dist/bin/

- name: stop sccache server
run: sccache --stop-server || true

# - name: upload venus-worker
# uses: actions/upload-artifact@v2
# with:
Expand Down

0 comments on commit 88e604f

Please sign in to comment.