From 300701eca5c49beb6782d5f729ed135a3cd96298 Mon Sep 17 00:00:00 2001 From: Niklas Dewally Date: Sat, 4 Nov 2023 09:50:23 +0000 Subject: [PATCH] CI: generate full cache on main --- .github/workflows/doc-coverage.yml | 2 +- .github/workflows/update-caches.yml | 60 +++++++++++++++++++++++++++++ etc/ci/genindex.py | 1 + 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/update-caches.yml diff --git a/.github/workflows/doc-coverage.yml b/.github/workflows/doc-coverage.yml index 92eade5d7d..d12c54cd2e 100644 --- a/.github/workflows/doc-coverage.yml +++ b/.github/workflows/doc-coverage.yml @@ -102,7 +102,7 @@ jobs: solvers/minion/vendor key: nightly-${{ runner.os }}-gitmodules-${{ steps.cache-vars.outputs.submodule_sha }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: nightly-${{ runner.os }}-gitmodules- + restore-keys: nightly-${{ runner.os }} - name: Use nightly run: rustup update nightly && rustup default nightly diff --git a/.github/workflows/update-caches.yml b/.github/workflows/update-caches.yml new file mode 100644 index 0000000000..44526fa5c1 --- /dev/null +++ b/.github/workflows/update-caches.yml @@ -0,0 +1,60 @@ +name: Full Caches +on: + push: + branches: + - main + +jobs: + caches: + strategy: + matrix: + version: [nightly,stable] + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + name: "Regenerate Caches ($${{ matrix.version }}, ${{ runner.os }}" + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + + - name: Generate caching variables + id: cache-vars + run: | + echo -e "submodule_sha=$(./etc/ci/get_submodules_hash.sh)" >> "$GITHUB_OUTPUT" + echo -e "submodule_sha=$(./etc/ci/get_submodules_hash.sh)" + + - name: Set up cache + uses: actions/cache/restore@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/ + ~/.cargo/git/ + target/ + solvers/minion/vendor + solvers/chuffed/vendor + + key: ${{ matrix.version }}-${{ runner.os }}-gitmodules-${{ steps.cache-vars.outputs.submodule_sha }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ matrix.version }}-${{ runner.os }} + + - name: Install rust ${{ matrix.version }} + run: rustup update ${{ matrix.version }} && rustup default ${{ matrix.version }} + + - run : cargo build --workspace + + - name: Delete cache if it already exists, so we can overwrite it + - run: | + gh cache delete "${{ matrix.version }}-${{ runner.os }}-gitmodules-${{ steps.cache-vars.outputs.submodule_sha }}-cargo-${{ hashFiles('**/Cargo.lock') }}" + # always succeed even if cache does not exist + true + + - name: Save cache + uses: actions/cache/save@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/ + ~/.cargo/git/ + target/ + solvers/minion/vendor + solvers/chuffed/vendor + key: ${{ matrix.version }}-${{ runner.os }}-gitmodules-${{ steps.cache-vars.outputs.submodule_sha }}-cargo-${{ hashFiles('**/Cargo.lock') }} diff --git a/etc/ci/genindex.py b/etc/ci/genindex.py index 12c591dee4..501929fe78 100755 --- a/etc/ci/genindex.py +++ b/etc/ci/genindex.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # --- +# # Copyright 2023 glowinthedark # # Licensed under the Apache License, Version 2.0 (the "License");