Skip to content

Commit c580e06

Browse files
ci: cache external binary downloads (Kubo, Rust nightly) (#142)
* ci: cache Kubo binary in setup-e2e action * ci: cache Rust nightly toolchain in e2e workflow
1 parent a2c1163 commit c580e06

2 files changed

Lines changed: 32 additions & 5 deletions

File tree

.github/actions/setup-e2e/action.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,23 @@ runs:
1919
with:
2020
bun-version: latest
2121

22+
- name: Restore Kubo from cache
23+
uses: actions/cache@v4
24+
with:
25+
path: ~/.cache/kubo
26+
key: kubo-v0.32.1-linux-amd64
27+
2228
- name: Install Kubo (IPFS)
2329
shell: bash
2430
run: |
25-
curl -fsSL -o kubo_v0.32.1_linux-amd64.tar.gz https://dist.ipfs.tech/kubo/v0.32.1/kubo_v0.32.1_linux-amd64.tar.gz
26-
tar xf kubo_v0.32.1_linux-amd64.tar.gz
27-
sudo mv kubo/ipfs /usr/local/bin/
31+
if [ ! -f ~/.cache/kubo/ipfs ]; then
32+
mkdir -p ~/.cache/kubo
33+
curl -fsSL -o /tmp/kubo.tar.gz https://dist.ipfs.tech/kubo/v0.32.1/kubo_v0.32.1_linux-amd64.tar.gz
34+
tar -xf /tmp/kubo.tar.gz -C /tmp
35+
cp /tmp/kubo/ipfs ~/.cache/kubo/ipfs
36+
rm -rf /tmp/kubo /tmp/kubo.tar.gz
37+
fi
38+
sudo cp ~/.cache/kubo/ipfs /usr/local/bin/ipfs
2839
ipfs init --profile=test
2940
ipfs version
3041

.github/workflows/e2e.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,22 @@ jobs:
110110
- id: setup
111111
uses: ./.github/actions/setup-e2e
112112

113+
- name: Compute Rust cache key
114+
id: rust-key
115+
if: matrix.cell == 'pr-deploy-cdm'
116+
shell: bash
117+
run: echo "key=rust-nightly-x86_64-$(date +%Y-%V)" >> "$GITHUB_OUTPUT"
118+
119+
- name: Restore Rust toolchain from cache
120+
if: matrix.cell == 'pr-deploy-cdm'
121+
uses: actions/cache@v4
122+
with:
123+
path: |
124+
~/.rustup/toolchains
125+
~/.cargo/bin
126+
key: ${{ steps.rust-key.outputs.key }}
127+
restore-keys: rust-nightly-x86_64-
128+
113129
- name: Install Rust/CDM toolchain
114130
if: matrix.cell == 'pr-deploy-cdm'
115131
shell: bash
@@ -118,9 +134,9 @@ jobs:
118134
sudo apt-get install -y -q --no-install-recommends build-essential pkg-config
119135
if ! command -v rustup >/dev/null 2>&1; then
120136
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
121-
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
122-
source "$HOME/.cargo/env"
123137
fi
138+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
139+
source "$HOME/.cargo/env"
124140
rustup toolchain install nightly --profile minimal --component rust-src
125141
rustup default nightly
126142
curl -fsSL https://raw.githubusercontent.com/paritytech/contract-dependency-manager/main/install.sh | bash

0 commit comments

Comments
 (0)