Skip to content

Commit

Permalink
chore(github CI): add sccache to lint (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmountaintop authored Sep 23, 2021
1 parent 64a5307 commit 138f8a0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 26 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install libpq
run: sudo apt-get install libpq-dev

- name: Install rust 1.53.0 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.53.0
override: true
components: rustfmt, clippy

- name: Cache cargo registry
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -64,17 +75,6 @@ jobs:
printf "[build]\nrustc-wrapper = \"/home/runner/.cargo/bin/sccache\"" >> ~/.cargo/config
~/.cargo/bin/sccache -s
- name: Install libpq
run: sudo apt-get install libpq-dev

- name: Install rust 1.53.0 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.53.0
override: true
components: rustfmt, clippy

- name: Install Node.js 16
uses: actions/setup-node@v2
with:
Expand Down
38 changes: 31 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ on:
- prod
- release/*

env:
SCCACHE_REGION: ap-northeast-1
SCCACHE_BUCKET: ff-building
SCCACHE_S3_USE_SSL: true
SCCACHE_S3_KEY_PREFIX: sccache-gh-action
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CARGO_INCREMENTAL: false

jobs:
rust-lint:
runs-on: ubuntu-latest
Expand All @@ -24,6 +33,14 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install 1.53.0 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.53.0
override: true
components: rustfmt, clippy

- name: Cache cargo registry
uses: actions/cache@v2
with:
Expand All @@ -42,13 +59,17 @@ jobs:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

- name: Install 1.53.0 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.53.0
override: true
components: rustfmt, clippy
- name: Setup sccache
run: |
cd $RUNNER_TEMP
export NAME="sccache-v0.2.15-x86_64-unknown-linux-musl"
curl -fsSOL https://github.com/mozilla/sccache/releases/download/v0.2.15/$NAME.tar.gz
tar xzf $NAME.tar.gz
mkdir -p ~/.cargo/bin
mv ./$NAME/sccache ~/.cargo/bin
chmod +x ~/.cargo/bin/sccache
printf "[build]\nrustc-wrapper = \"/home/runner/.cargo/bin/sccache\"" >> ~/.cargo/config
~/.cargo/bin/sccache -s
- name: Run "cargo fmt & check"
uses: actions-rs/cargo@v1
Expand All @@ -63,6 +84,9 @@ jobs:
command: clippy
args: -- -D warnings

- name: show sccache stats
run: ~/.cargo/bin/sccache -s

js-lint:
runs-on: ubuntu-latest

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install 1.53.0 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.53.0
override: true
components: rustfmt, clippy

- name: Cache cargo registry
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -63,14 +71,6 @@ jobs:
printf "[build]\nrustc-wrapper = \"/home/runner/.cargo/bin/sccache\"" >> ~/.cargo/config
~/.cargo/bin/sccache -s
- name: Install 1.53.0 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.53.0
override: true
components: rustfmt, clippy

- name: Run "cargo test"
uses: actions-rs/cargo@v1
with:
Expand Down

0 comments on commit 138f8a0

Please sign in to comment.