From b705e89a8e0dfa6962b9adc4b2b1e7a69635743d Mon Sep 17 00:00:00 2001 From: FUJI Goro Date: Mon, 25 Dec 2023 11:04:01 +0900 Subject: [PATCH] cache cargo db in GHA --- .github/workflows/ci.yml | 11 +++++++++++ .github/workflows/dpz-bot.yml | 11 +++++++++++ rust-toolchain.toml | 2 ++ 3 files changed, 24 insertions(+) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b78bee..f9ec1b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + # https://github.com/actions/cache/blob/main/examples.md#rust---cargo + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/rust-toolchain.toml') }} + - name: Build run: cargo build --verbose - name: Run tests diff --git a/.github/workflows/dpz-bot.yml b/.github/workflows/dpz-bot.yml index c57caa9..f90364e 100644 --- a/.github/workflows/dpz-bot.yml +++ b/.github/workflows/dpz-bot.yml @@ -14,6 +14,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + # https://github.com/actions/cache/blob/main/examples.md#rust---cargo + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/rust-toolchain.toml') }} + - name: Build run: cargo build - name: Run run diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..292fe49 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable"