cache /nix directly
This commit is contained in:
parent
e857aaee64
commit
b2be89e318
|
@ -15,7 +15,7 @@ jobs:
|
||||||
uses: actions/cache@v3.0.8
|
uses: actions/cache@v3.0.8
|
||||||
id: nix-cache
|
id: nix-cache
|
||||||
with:
|
with:
|
||||||
path: /tmp/nixcache
|
path: /nix
|
||||||
key: "dref-cache-v1"
|
key: "dref-cache-v1"
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
|
@ -26,10 +26,6 @@ jobs:
|
||||||
- name: Remove access_tokens
|
- name: Remove access_tokens
|
||||||
run: sed -i '/^access-tokens/d' /etc/nix/nix.conf
|
run: sed -i '/^access-tokens/d' /etc/nix/nix.conf
|
||||||
|
|
||||||
- name: "Import Nix store cache"
|
|
||||||
if: "steps.nix-cache.outputs.cache-hit == 'true'"
|
|
||||||
run: "nix-store --import < /tmp/nixcache"
|
|
||||||
|
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3.5.3
|
uses: actions/checkout@v3.5.3
|
||||||
with:
|
with:
|
||||||
|
@ -37,11 +33,6 @@ jobs:
|
||||||
- name: Check codebase
|
- name: Check codebase
|
||||||
run: nix flake check -L
|
run: nix flake check -L
|
||||||
|
|
||||||
- name: "Export Nix store cache"
|
|
||||||
if: "steps.nix-cache.outputs.cache-hit != 'true'"
|
|
||||||
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"
|
|
||||||
|
|
||||||
|
|
||||||
docker-build:
|
docker-build:
|
||||||
needs: nix-flake-check
|
needs: nix-flake-check
|
||||||
runs-on: debian-latest
|
runs-on: debian-latest
|
||||||
|
@ -49,11 +40,12 @@ jobs:
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
run: apt update && apt install -y sudo zstd
|
run: apt update && apt install -y sudo zstd
|
||||||
|
|
||||||
|
|
||||||
- name: "Cache Nix store"
|
- name: "Cache Nix store"
|
||||||
uses: actions/cache@v3.0.8
|
uses: actions/cache@v3.0.8
|
||||||
id: nix-cache
|
id: nix-cache
|
||||||
with:
|
with:
|
||||||
path: /tmp/nixcache
|
path: /nix
|
||||||
key: "dref-cache-v1"
|
key: "dref-cache-v1"
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
|
@ -64,10 +56,6 @@ jobs:
|
||||||
- name: Remove access_tokens
|
- name: Remove access_tokens
|
||||||
run: sed -i '/^access-tokens/d' /etc/nix/nix.conf
|
run: sed -i '/^access-tokens/d' /etc/nix/nix.conf
|
||||||
|
|
||||||
- name: "Import Nix store cache"
|
|
||||||
if: "steps.nix-cache.outputs.cache-hit == 'true'"
|
|
||||||
run: "nix-store --import < /tmp/nixcache"
|
|
||||||
|
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3.5.3
|
uses: actions/checkout@v3.5.3
|
||||||
with:
|
with:
|
||||||
|
@ -80,11 +68,6 @@ jobs:
|
||||||
wget https://raw.githubusercontent.com/containers/skopeo/main/default-policy.json && mkdir /etc/containers && mv default-policy.json /etc/containers/policy.json
|
wget https://raw.githubusercontent.com/containers/skopeo/main/default-policy.json && mkdir /etc/containers && mv default-policy.json /etc/containers/policy.json
|
||||||
skopeo copy docker-archive:result docker://icr.gmem.ca/dref:latest
|
skopeo copy docker-archive:result docker://icr.gmem.ca/dref:latest
|
||||||
|
|
||||||
- name: "Export Nix store cache"
|
|
||||||
if: "steps.nix-cache.outputs.cache-hit != 'true'"
|
|
||||||
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"
|
|
||||||
|
|
||||||
|
|
||||||
arm-docker-build:
|
arm-docker-build:
|
||||||
needs: nix-flake-check
|
needs: nix-flake-check
|
||||||
runs-on: debian-latest-arm
|
runs-on: debian-latest-arm
|
||||||
|
@ -92,11 +75,12 @@ jobs:
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
run: apt update && apt install -y sudo zstd
|
run: apt update && apt install -y sudo zstd
|
||||||
|
|
||||||
|
|
||||||
- name: "Cache Nix store"
|
- name: "Cache Nix store"
|
||||||
uses: actions/cache@v3.0.8
|
uses: actions/cache@v3.0.8
|
||||||
id: nix-cache
|
id: nix-cache
|
||||||
with:
|
with:
|
||||||
path: /tmp/nixcache
|
path: /nix
|
||||||
key: "dref-cache-arm-v1"
|
key: "dref-cache-arm-v1"
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
|
@ -107,10 +91,6 @@ jobs:
|
||||||
- name: Remove access_tokens
|
- name: Remove access_tokens
|
||||||
run: sed -i '/^access-tokens/d' /etc/nix/nix.conf
|
run: sed -i '/^access-tokens/d' /etc/nix/nix.conf
|
||||||
|
|
||||||
- name: "Import Nix store cache"
|
|
||||||
if: "steps.nix-cache.outputs.cache-hit == 'true'"
|
|
||||||
run: "nix-store --import < /tmp/nixcache"
|
|
||||||
|
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3.5.3
|
uses: actions/checkout@v3.5.3
|
||||||
with:
|
with:
|
||||||
|
@ -122,7 +102,3 @@ jobs:
|
||||||
nix-env -i skopeo -f '<nixpkgs>'
|
nix-env -i skopeo -f '<nixpkgs>'
|
||||||
wget https://raw.githubusercontent.com/containers/skopeo/main/default-policy.json && mkdir /etc/containers && mv default-policy.json /etc/containers/policy.json
|
wget https://raw.githubusercontent.com/containers/skopeo/main/default-policy.json && mkdir /etc/containers && mv default-policy.json /etc/containers/policy.json
|
||||||
skopeo copy docker-archive:result docker://icr.gmem.ca/dref:arm
|
skopeo copy docker-archive:result docker://icr.gmem.ca/dref:arm
|
||||||
|
|
||||||
- name: "Export Nix store cache"
|
|
||||||
if: "steps.nix-cache.outputs.cache-hit != 'true'"
|
|
||||||
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"
|
|
||||||
|
|
Loading…
Reference in a new issue