Revert caching
This commit is contained in:
parent
c9d65f8de9
commit
7b0b26b09b
|
@ -9,26 +9,26 @@ jobs:
|
||||||
runs-on: debian-latest
|
runs-on: debian-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
run: |
|
run: apt update && apt install -y sudo zstd
|
||||||
apt update && apt install -y sudo zstd jq
|
|
||||||
echo "USER=$(whoami)" >> $GITHUB_ENV
|
- name: "Cache Nix store"
|
||||||
groupadd -r nixbld
|
uses: actions/cache@v3.0.8
|
||||||
for n in $(seq 1 10); do useradd -c "Nix build user $n" -d /var/empty -g nixbld -G nixbld -M -N -r -s "$(command -v nologin)" "nixbld$n"; done
|
id: nix-cache
|
||||||
|
with:
|
||||||
|
path: /tmp/nixcache
|
||||||
|
key: "dref-cache-v1"
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: https://github.com/nixbuild/nix-quick-install-action@v25
|
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
|
||||||
- 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: Restore and cache Nix store
|
- name: "Import Nix store cache"
|
||||||
uses: https://github.com/nix-community/cache-nix-action@v1
|
if: "steps.nix-cache.outputs.cache-hit == 'true'"
|
||||||
with:
|
run: "nix-store --import < /tmp/nixcache"
|
||||||
linux-gc-enabled: true
|
|
||||||
linux-max-store-size: 536870912
|
|
||||||
key: cache-${{ matrix.os }}-${{ hashFiles('**/*') }}
|
|
||||||
restore-keys: |
|
|
||||||
cache-${{ matrix.os }}
|
|
||||||
|
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3.5.3
|
uses: actions/checkout@v3.5.3
|
||||||
|
@ -37,6 +37,11 @@ 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
|
||||||
|
@ -44,20 +49,24 @@ jobs:
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
run: apt update && apt install -y sudo zstd
|
run: apt update && apt install -y sudo zstd
|
||||||
|
|
||||||
- name: Install Nix
|
- name: "Cache Nix store"
|
||||||
uses: https://github.com/nixbuild/nix-quick-install-action@v25
|
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
|
||||||
- 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: Restore and cache Nix store
|
- name: "Import Nix store cache"
|
||||||
uses: https://github.com/nix-community/cache-nix-action@v1
|
if: "steps.nix-cache.outputs.cache-hit == 'true'"
|
||||||
with:
|
run: "nix-store --import < /tmp/nixcache"
|
||||||
linux-gc-enabled: true
|
|
||||||
linux-max-store-size: 536870912
|
|
||||||
key: cache-${{ matrix.os }}-${{ hashFiles('**/*') }}
|
|
||||||
restore-keys: |
|
|
||||||
cache-${{ matrix.os }}
|
|
||||||
|
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3.5.3
|
uses: actions/checkout@v3.5.3
|
||||||
|
@ -71,6 +80,11 @@ 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
|
||||||
|
@ -78,20 +92,24 @@ jobs:
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
run: apt update && apt install -y sudo zstd
|
run: apt update && apt install -y sudo zstd
|
||||||
|
|
||||||
- name: Install Nix
|
- name: "Cache Nix store"
|
||||||
uses: https://github.com/nixbuild/nix-quick-install-action@v25
|
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
|
||||||
- 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: Restore and cache Nix store
|
- name: "Import Nix store cache"
|
||||||
uses: https://github.com/nix-community/cache-nix-action@v1
|
if: "steps.nix-cache.outputs.cache-hit == 'true'"
|
||||||
with:
|
run: "nix-store --import < /tmp/nixcache"
|
||||||
linux-gc-enabled: true
|
|
||||||
linux-max-store-size: 536870912
|
|
||||||
key: cache-${{ matrix.os }}-${{ hashFiles('**/*') }}
|
|
||||||
restore-keys: |
|
|
||||||
cache-${{ matrix.os }}
|
|
||||||
|
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3.5.3
|
uses: actions/checkout@v3.5.3
|
||||||
|
@ -104,3 +122,7 @@ 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