Skip to content

Commit

Permalink
ci: update cache strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
binhtran432k committed Mar 23, 2024
1 parent 6d90ef5 commit 94254ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,19 @@ jobs:
PERSEUS_VERSION: 0.4.0
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
steps:
- name: Checkout respository
uses: actions/checkout@v4

- name: Cache Cargo and Rustup
- name: Cache cargo binaries
uses: actions/cache@v4
id: cache
with:
path: |
~/.cargo/
~/.rustup/
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-website-cargo-bins-$PERSEUS_VERSION

- name: Setup Rust
if: steps.cache.outputs.cache-hit != 'true'
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}

# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand All @@ -42,6 +33,9 @@ jobs:
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
dist/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/gh-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,22 @@ jobs:
PERSEUS_VERSION: 0.4.0
name: Build Static Site Generation
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Cache Cargo and Rustup
- name: Cache cargo binaries
uses: actions/cache@v4
id: cache
with:
path: |
~/.cargo/
~/.rustup/
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-website-cargo-bins-$PERSEUS_VERSION

- name: Setup Rust
if: steps.cache.outputs.cache-hit != 'true'
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}

# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand All @@ -54,9 +45,12 @@ jobs:
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
dist/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-cargo-build-${{ hashFiles('Cargo.lock') }}

- name: Build using Perseus
run: perseus export --release
Expand Down

0 comments on commit 94254ed

Please sign in to comment.