-
Notifications
You must be signed in to change notification settings - Fork 519
58 lines (58 loc) · 2.18 KB
/
cache.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# This workflow caches crate dependencies and build artifacts for tools (except 'test-tools' since we don't use them in build workflows).
# The cache is only usable by workflows started from pull requests against the develop branch.
name: CacheDepsAndTools
on:
push:
branches: [1.14.x]
paths:
- '.github/**'
- 'sources/Cargo.lock'
- 'tools/buildsys/**'
- 'tools/pubsys*/**'
- '!tools/pubsys/policies/**'
- '!tools/pubsys/**.example'
- '!tools/pubsys/**.template'
- 'tools/Cargo.lock'
jobs:
cache:
if: github.repository == 'bottlerocket-os/bottlerocket'
runs-on:
group: bottlerocket
labels: bottlerocket_ubuntu-latest_16-core
continue-on-error: true
steps:
- run: |
echo "OS_ARCH=`uname -m`" >> $GITHUB_ENV
- uses: actions/checkout@v3
# Cache `cargo-make`, `cargo-cache`, `cargo-sweep`
- uses: actions/cache@v3
with:
path: |
~/.cargo
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}
# Cache first-party code dependencies
- uses: actions/cache@v3
with:
path: |
.cargo
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}-${{ hashFiles('sources/Cargo.lock') }}
# Cache 'tools/' dependencies and build artifacts
- uses: actions/cache@v3
with:
path: |
tools/bin
tools/.crates.toml
tools/.crates2.json
tools/target
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}-${{ hashFiles('tools/Cargo.lock') }}
- run: cargo install --locked --version 0.36.0 cargo-make
- run: cargo install --locked --version 0.8.3 --no-default-features --features ci-autoclean cargo-cache
- run: cargo install --locked --version 0.6.2 cargo-sweep
- run: |
cargo sweep -i -r tools/
cargo sweep -t 7 -r tools/
- run: cargo make publish-setup-tools
- run: cargo make publish-tools
- run: cargo make build-tools
# This cleans the cargo cache in ~/.cargo
- run: cargo-cache