ci: Build and cache CI jobs individually
Some checks failed
CI / Check, build and cache Nix flake (push) Failing after 4m20s

This commit is contained in:
Jack O'Sullivan 2024-11-26 12:29:44 +00:00
parent 6c98ef8944
commit f2271ec354
3 changed files with 21 additions and 14 deletions

View File

@ -25,15 +25,19 @@ jobs:
extra-trusted-public-keys = nix-cache.nul.ie-1:BzH5yMfF4HbzY1C977XzOxoPhEc9Zbu39ftPkUbH+m4=
- name: Check flake
run: nix flake check
- name: Build the world
run: nix flake check --no-build
- name: Build (and cache) the world
id: build
run: |
path=$(nix build --no-link .#ci.x86_64-linux --json | jq -r .[0].outputs.out)
echo "path=$path" >> "$GITHUB_OUTPUT"
- name: Push to cache
env:
HARMONIA_SSH_KEY: ${{ secrets.HARMONIA_SSH_KEY }}
run: |
ci/push-to-cache.sh "${{ steps.build.outputs.path }}"
nix eval --json --apply "builtins.attrNames" | jq -cr '.[]' | while read job; do
echo "Building $job"
path="$(nix build --no-link .#ci.x86_64-linux."$job" --json | jq -r .[0].outputs.out)"
echo "Caching $job"
ci/push-to-cache.sh "$path"
done
echo "Building and caching CI derivation"
path="$(nix build --no-link .#ciDrv.x86_64-linux --json | jq -r .[0].outputs.out)"
UPDATE_PROFILE=1 ci/push-to-cache.sh "$path"

View File

@ -22,8 +22,10 @@ path="$1"
echo "Pushing $path to cache..."
nix copy --no-check-sigs --to "$STORE_URI" "$path"
if [ -n "$UPDATE_PROFILE" ]; then
echo "Updating profile..."
remote_cmd nix-env -p "$REMOTE_STORE"/nix/var/nix/profiles/nixfiles --set "$path"
echo "Collecting garbage..."
remote_cmd nix-collect-garbage --delete-older-than 30d
remote_cmd nix-collect-garbage --delete-older-than 60d
fi

View File

@ -204,8 +204,9 @@
systems' = mapAttrs' (n: v: nameValuePair "system-${n}" v) systems;
packages' = mapAttrs' (n: v: nameValuePair "package-${n}" v) packages;
in
pkgs.linkFarm "ci" (homes' // systems' // packages' // {
homes' // systems' // packages' // {
inherit shell;
});
};
ciDrv = pkgs.linkFarm "ci" ci;
}));
}