Skip to content

Commit 23db8ba

Browse files
committed
cache nix env
1 parent 71efd4d commit 23db8ba

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,19 @@ jobs:
4747
- name: Setup sccache
4848
uses: mozilla-actions/sccache-action@v0.0.9
4949

50+
- name: Cache nix dev environment
51+
id: cache-nix-env
52+
uses: actions/cache@v4
53+
with:
54+
path: /tmp/nix-dev-env.sh
55+
key: nix-env-pureRust-ci-${{ hashFiles('flake.lock', 'flake.nix') }}
56+
5057
- name: Setup nix environment
58+
if: steps.cache-nix-env.outputs.cache-hit != 'true'
59+
run: nix print-dev-env '.#pureRust-ci' --accept-flake-config > /tmp/nix-dev-env.sh
60+
61+
- name: Configure sccache
5162
run: |
52-
nix print-dev-env '.#pureRust-ci' --accept-flake-config > /tmp/nix-dev-env.sh
5363
echo "export SCCACHE_GHA_ENABLED=true" >> /tmp/nix-dev-env.sh
5464
echo "export SCCACHE_CACHE_SIZE=2G" >> /tmp/nix-dev-env.sh
5565
@@ -128,9 +138,19 @@ jobs:
128138
- name: Setup sccache
129139
uses: mozilla-actions/sccache-action@v0.0.9
130140

141+
- name: Cache nix dev environment
142+
id: cache-nix-env
143+
uses: actions/cache@v4
144+
with:
145+
path: /tmp/nix-dev-env.sh
146+
key: nix-env-ros-${{ matrix.distro }}-ci-${{ hashFiles('flake.lock', 'flake.nix') }}
147+
131148
- name: Setup nix environment
149+
if: steps.cache-nix-env.outputs.cache-hit != 'true'
150+
run: nix print-dev-env '.#ros-${{ matrix.distro }}-ci' --accept-flake-config > /tmp/nix-dev-env.sh
151+
152+
- name: Configure sccache
132153
run: |
133-
nix print-dev-env '.#ros-${{ matrix.distro }}-ci' --accept-flake-config > /tmp/nix-dev-env.sh
134154
echo "export SCCACHE_GHA_ENABLED=true" >> /tmp/nix-dev-env.sh
135155
echo "export SCCACHE_CACHE_SIZE=2G" >> /tmp/nix-dev-env.sh
136156

0 commit comments

Comments
 (0)