From 33e9c58edb1b69f1d0f30fdd8c470670b3c89504 Mon Sep 17 00:00:00 2001 From: Hicham Date: Tue, 10 Sep 2024 09:54:17 +0200 Subject: [PATCH] ci: cache sdk --- .github/workflows/benchmark.yml | 24 +++++++++++++++-------- .github/workflows/coverage.yml | 24 +++++++++++++++-------- .github/workflows/workflow.yml | 34 ++++++++++++++++++++------------- Makefile | 10 ++++++---- 4 files changed, 59 insertions(+), 33 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 5f3647e..2bacf15 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -19,23 +19,31 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 # v4 - - name: Google Storage authentication - uses: google-github-actions/auth@v2 - with: - credentials_json: '${{ secrets.GCP_CREDENTIALS }}' - export_environment_variables: true - create_credentials_file: true - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@v2 - name: Cache sample slide id: cache-slide uses: actions/cache@v4 with: path: tests/data/ key: slides-test + - name: Cache SDK + id: cache-sdk + uses: actions/cache@v4 + with: + path: tmp/sdk/ + key: cache-sdk + - name: Google Storage authentication + if: ${{ steps.cache-slide.outputs.cache-hit != 'true' && steps.cache-sdk.outputs.cache-hit != 'true' }} + uses: google-github-actions/auth@v2 + with: + credentials_json: '${{ secrets.GCP_CREDENTIALS }}' + export_environment_variables: true + create_credentials_file: true - name: Download sample tests data if: steps.cache-slide.outputs.cache-hit != 'true' run: make dl-test-images + - name: Download dependencies + if: steps.cache-sdk.outputs.cache-hit != 'true' + run: make dl-sdk - name: Install dependencies run: make install-deps - uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 02072cf..74b34ee 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -16,23 +16,31 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 # v4 - - name: Google Storage authentication - uses: google-github-actions/auth@v2 - with: - credentials_json: '${{ secrets.GCP_CREDENTIALS }}' - export_environment_variables: true - create_credentials_file: true - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@v2 - name: Cache sample slide id: cache-slide uses: actions/cache@v4 with: path: tests/data/ key: slides-test + - name: Cache SDK + id: cache-sdk + uses: actions/cache@v4 + with: + path: tmp/sdk/ + key: cache-sdk + - name: Google Storage authentication + if: ${{ steps.cache-slide.outputs.cache-hit != 'true' && steps.cache-sdk.outputs.cache-hit != 'true' }} + uses: google-github-actions/auth@v2 + with: + credentials_json: '${{ secrets.GCP_CREDENTIALS }}' + export_environment_variables: true + create_credentials_file: true - name: Download sample tests data if: steps.cache-slide.outputs.cache-hit != 'true' run: make dl-test-images + - name: Download dependencies + if: steps.cache-sdk.outputs.cache-hit != 'true' + run: make dl-sdk - name: Install dependencies run: make install-deps - uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 8121830..94bc048 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -25,31 +25,39 @@ jobs: steps: - uses: actions/checkout@v4 # v4 - - name: Google Storage authentication - uses: google-github-actions/auth@v2 - with: - credentials_json: '${{ secrets.GCP_CREDENTIALS }}' - export_environment_variables: true - create_credentials_file: true - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@v2 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.RUST_VERSION }} - name: Cache sample slide id: cache-slide uses: actions/cache@v4 with: path: tests/data/ key: slides-test + - name: Cache SDK + id: cache-sdk + uses: actions/cache@v4 + with: + path: tmp/sdk/ + key: cache-sdk + - name: Google Storage authentication + if: ${{ steps.cache-slide.outputs.cache-hit != 'true' && steps.cache-sdk.outputs.cache-hit != 'true' }} + uses: google-github-actions/auth@v2 + with: + credentials_json: '${{ secrets.GCP_CREDENTIALS }}' + export_environment_variables: true + create_credentials_file: true - name: Download sample tests data if: steps.cache-slide.outputs.cache-hit != 'true' run: make dl-test-images + - name: Download dependencies + if: steps.cache-sdk.outputs.cache-hit != 'true' + run: make dl-sdk + - name: Install dependencies + run: make install-deps + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.RUST_VERSION }} - uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.os }}-${{ matrix.feature }} - - name: Install dependencies ubuntu - run: make install-deps - name: Build & Test run: cargo test --workspace ${{ matrix.feature }} -- --nocapture --test-threads=1 diff --git a/Makefile b/Makefile index 4c1236d..8623a41 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,15 @@ .PHONY: install-deps dl-test-images +dl-sdk: + cd /tmp && \ + gsutil cp gs://az-philips/sdk.zip . && \ + unzip sdk.zip -d . + install-deps: export DEBIAN_FRONTEND=noninteractive && \ sudo apt-get update -qq && \ sudo apt-get install -y --no-install-recommends unzip binutils build-essential && \ - cd /tmp && \ - gsutil cp gs://az-philips/sdk.zip . && \ - unzip sdk.zip -d . && \ - cd ./sdk && \ + cd /tmp/sdk && \ chmod +x InstallPathologySDK.sh && \ sudo ./InstallPathologySDK.sh -y