Test nix-community/cache-nix-build action
Some checks failed
Build Docker Image / nix-flake-check (push) Failing after 13s
Build Docker Image / docker-build (push) Has been skipped
Build Docker Image / arm-docker-build (push) Has been skipped

This commit is contained in:
Gabriel Simmer 2023-08-16 09:40:07 +01:00
parent c50978b961
commit d5de566ffc
Signed by: arch
SSH key fingerprint: SHA256:mXaHIY3tLtudNyb+i3qRd0DeXvpqbst04OgVKVCp2R4

View file

@ -11,24 +11,20 @@ jobs:
- name: Install prerequisites
run: apt update && apt install -y sudo zstd
- name: "Cache Nix store"
uses: actions/cache@v3.0.8
id: nix-cache
with:
path: /tmp/nixcache
key: "dref-cache-v1"
- name: Install Nix
uses: https://github.com/cachix/install-nix-action@v22
with:
extra_nix_config: "experimental-features = nix-command flakes"
nix_path: nixpkgs=channel:nixos-23.05
uses: https://github.com/nixbuild/nix-quick-install-action@v25
- name: Remove access_tokens
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: Restore and cache Nix store
uses: https://github.com/nix-community/cache-nix-action@v1
with:
linux-gc-enabled: true
linux-max-store-size: 536870912
key: cache-${{ matrix.os }}-${{ hashFiles('**/*') }}
restore-keys: |
cache-${{ matrix.os }}
- name: Check out repository
uses: actions/checkout@v3.5.3
@ -37,11 +33,6 @@ jobs:
- name: Check codebase
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:
needs: nix-flake-check
runs-on: debian-latest
@ -49,24 +40,20 @@ jobs:
- name: Install prerequisites
run: apt update && apt install -y sudo zstd
- name: "Cache Nix store"
uses: actions/cache@v3.0.8
id: nix-cache
with:
path: /tmp/nixcache
key: "dref-cache-v1"
- name: Install Nix
uses: https://github.com/cachix/install-nix-action@v22
with:
extra_nix_config: "experimental-features = nix-command flakes"
nix_path: nixpkgs=channel:nixos-23.05
uses: https://github.com/nixbuild/nix-quick-install-action@v25
- name: Remove access_tokens
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: Restore and cache Nix store
uses: https://github.com/nix-community/cache-nix-action@v1
with:
linux-gc-enabled: true
linux-max-store-size: 536870912
key: cache-${{ matrix.os }}-${{ hashFiles('**/*') }}
restore-keys: |
cache-${{ matrix.os }}
- name: Check out repository
uses: actions/checkout@v3.5.3
@ -80,11 +67,6 @@ jobs:
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
- 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:
needs: nix-flake-check
runs-on: debian-latest-arm
@ -92,24 +74,20 @@ jobs:
- name: Install prerequisites
run: apt update && apt install -y sudo zstd
- name: "Cache Nix store"
uses: actions/cache@v3.0.8
id: nix-cache
with:
path: /tmp/nixcache
key: "dref-cache-arm-v1"
- name: Install Nix
uses: https://github.com/cachix/install-nix-action@v22
with:
extra_nix_config: "experimental-features = nix-command flakes"
nix_path: nixpkgs=channel:nixos-23.05
uses: https://github.com/nixbuild/nix-quick-install-action@v25
- name: Remove access_tokens
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: Restore and cache Nix store
uses: https://github.com/nix-community/cache-nix-action@v1
with:
linux-gc-enabled: true
linux-max-store-size: 536870912
key: cache-${{ matrix.os }}-${{ hashFiles('**/*') }}
restore-keys: |
cache-${{ matrix.os }}
- name: Check out repository
uses: actions/checkout@v3.5.3
@ -122,7 +100,3 @@ jobs:
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
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"