Skip to content

Commit

Permalink
try caching and restoring cargo and sqlx binary
Browse files Browse the repository at this point in the history
  • Loading branch information
TIL-EBP committed Oct 31, 2024
1 parent e4237cc commit 86d78c1
Showing 1 changed file with 46 additions and 4 deletions.
50 changes: 46 additions & 4 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,29 @@ jobs:
uses: actions/cache@v4
with:
path: target
key: cargo-build-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
key: cargo-build-${{ runner.os }}-${{ hashFiles('./api/Cargo.lock') }}
restore-keys: |
cargo-build-${{ runner.os }}-
- name: Cache sqlx binary
uses: actions/cache@v4
with:
path: ~/.cargo/bin/sqlx
key: sqlx-${{ runner.os }}-${{ hashFiles('./api/Cargo.lock') }}
restore-keys: |
sqlx-${{ runner.os }}-
- name: Install Rust dependencies
env:
DATABASE_URL: "postgres://www-data:www-data@localhost:15432/swissgeol-local"
run: |
docker compose up -d db
docker compose logs -f &
# docker compose logs -f &
sleep 10
cd api
cd api
if [ ! -f ~/.cargo/bin/sqlx ]; then
cargo install sqlx-cli --version 0.7.3 --no-default-features --features native-tls,postgres --locked --quiet
fi
sqlx database create
sqlx migrate run

Expand All @@ -202,12 +212,44 @@ jobs:
toolchain: 1.73
profile: minimal
override: true

- name: Restore cached cargo registry
uses: actions/cache/restore@v4actions/cache/restore@v4
with:
path: ~/.cargo/registry
key: cargo-registry-${{ runner.os }}-${{ hashFiles('./api/Cargo.lock') }}
restore-keys: |
cargo-registry-${{ runner.os }}-
- name: Restore cached cargo index
uses: actions/cache/restore@v4
with:
path: ~/.cargo/git
key: cargo-index-${{ runner.os }}-${{ hashFiles('./api/Cargo.lock') }}
restore-keys: |
cargo-index-${{ runner.os }}-
- name: Restore cached cargo build
uses: actions/cache/restore@v4
with:
path: target
key: cargo-build-${{ runner.os }}-${{ hashFiles('./api/Cargo.lock') }}
restore-keys: |
cargo-build-${{ runner.os }}-
- name: Restore cached sqlx binary
uses: actions/cache/restore@v4
with:
path: ~/.cargo/bin/sqlx
key: sqlx-${{ runner.os }}-${{ hashFiles('./api/Cargo.lock') }}
restore-keys: |
sqlx-${{ runner.os }}-
- name: Install Rust dependencies
env:
DATABASE_URL: "postgres://www-data:www-data@localhost:15432/swissgeol-local"
run: |
docker compose up -d db
docker compose logs -f &
# docker compose logs -f &
sleep 10
cd api
cargo install sqlx-cli --version 0.7.3 --no-default-features --features native-tls,postgres --locked --quiet
Expand Down

0 comments on commit 86d78c1

Please sign in to comment.