Skip to content

Commit

Permalink
CI: generate full cache on main
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasdewally committed Nov 4, 2023
1 parent 9bb6f80 commit 300701e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/doc-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/update-caches.yml
Original file line number Diff line number Diff line change
@@ -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') }}
1 change: 1 addition & 0 deletions etc/ci/genindex.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
# ---
#
# Copyright 2023 glowinthedark
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down

0 comments on commit 300701e

Please sign in to comment.