From 86d78c16ca91aeafe17904994541bc41d876f8d0 Mon Sep 17 00:00:00 2001 From: till_schuetze Date: Thu, 31 Oct 2024 08:00:19 +0100 Subject: [PATCH] try caching and restoring cargo and sqlx binary --- .github/workflows/code-quality.yml | 50 +++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index df741d1ff..f9c2da7fc 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -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 @@ -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