fix builds in CI (#322)
This commit is contained in:
parent
b8a570ae0d
commit
2dd3f4cff1
4 changed files with 117 additions and 35 deletions
105
.github/workflows/build.yaml
vendored
Normal file
105
.github/workflows/build.yaml
vendored
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
# name: build
|
||||||
|
# on: push
|
||||||
|
# jobs:
|
||||||
|
# checks:
|
||||||
|
# uses: nixbuild/nixbuild-action/.github/workflows/ci-workflow.yml@v19
|
||||||
|
# with:
|
||||||
|
# nix_conf: |
|
||||||
|
# allow-import-from-derivation = true
|
||||||
|
# secrets:
|
||||||
|
# nixbuild_token: ${{ secrets.nixbuild_token }}
|
||||||
|
|
||||||
|
|
||||||
|
name: "build"
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
extra-conf: "system-features = nixos-test benchmark big-parallel kvm"
|
||||||
|
- name: Setup Caching
|
||||||
|
uses: cachix/cachix-action@v14
|
||||||
|
with:
|
||||||
|
name: selfhostblocks
|
||||||
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
- name: Generate Matrix
|
||||||
|
id: generate-matrix
|
||||||
|
run: |
|
||||||
|
nix flake show --allow-import-from-derivation --json \
|
||||||
|
| jq -c '.["checks"]["x86_64-linux"] | keys' > .output
|
||||||
|
|
||||||
|
cat .output
|
||||||
|
|
||||||
|
echo dynamic_list="$(cat .output)" >> "$GITHUB_OUTPUT"
|
||||||
|
outputs:
|
||||||
|
check: ${{ steps.generate-matrix.outputs.dynamic_list }}
|
||||||
|
|
||||||
|
manual:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
extra-conf: "system-features = nixos-test benchmark big-parallel kvm"
|
||||||
|
- name: Setup Caching
|
||||||
|
uses: cachix/cachix-action@v14
|
||||||
|
with:
|
||||||
|
name: selfhostblocks
|
||||||
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
nix \
|
||||||
|
--print-build-logs \
|
||||||
|
--option keep-going true \
|
||||||
|
--show-trace \
|
||||||
|
build .#manualHtml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ "build-matrix" ]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
check: ${{ fromJson(needs.build-matrix.outputs.check) }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
extra-conf: "system-features = nixos-test benchmark big-parallel kvm"
|
||||||
|
- name: Setup Caching
|
||||||
|
uses: cachix/cachix-action@v14
|
||||||
|
with:
|
||||||
|
name: selfhostblocks
|
||||||
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
nix build --print-build-logs --show-trace .#checks.x86_64-linux.${{ matrix.check }}
|
||||||
|
|
||||||
|
results:
|
||||||
|
if: ${{ always() }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Final Results
|
||||||
|
needs: [ manual, tests ]
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
result="${{ needs.tests.result }}"
|
||||||
|
if [[ $result == "success" || $result == "skipped" ]]; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
22
.github/workflows/garnix.yaml
vendored
22
.github/workflows/garnix.yaml
vendored
|
@ -1,22 +0,0 @@
|
||||||
# Leaving commented because it does not work.
|
|
||||||
#
|
|
||||||
# name: "Final Results"
|
|
||||||
#
|
|
||||||
# on:
|
|
||||||
# check_suite:
|
|
||||||
# types: [completed]
|
|
||||||
#
|
|
||||||
# jobs:
|
|
||||||
# results:
|
|
||||||
# name: Final Results
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# steps:
|
|
||||||
# - run: echo
|
|
||||||
# - run: exit 1
|
|
||||||
# # see https://stackoverflow.com/a/67532120/4907315
|
|
||||||
# if: >-
|
|
||||||
# ${{
|
|
||||||
# contains(needs.*.result, 'failure')
|
|
||||||
# || contains(needs.*.result, 'cancelled')
|
|
||||||
# || contains(needs.*.result, 'skipped')
|
|
||||||
# }}
|
|
6
.github/workflows/pages.yml
vendored
6
.github/workflows/pages.yml
vendored
|
@ -2,14 +2,8 @@
|
||||||
name: Deploy docs
|
name: Deploy docs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Runs on pushes targeting the default branch
|
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
# TODO: needed ?
|
|
||||||
# schedule:
|
|
||||||
# - cron: 0 0 * * 1
|
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
|
|
19
flake.nix
19
flake.nix
|
@ -26,7 +26,6 @@
|
||||||
src = nixpkgs;
|
src = nixpkgs;
|
||||||
inherit patches;
|
inherit patches;
|
||||||
};
|
};
|
||||||
|
|
||||||
pkgs = import patchedNixpkgs {
|
pkgs = import patchedNixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
|
@ -79,12 +78,14 @@
|
||||||
|
|
||||||
checks =
|
checks =
|
||||||
let
|
let
|
||||||
|
inherit (pkgs.lib) foldl foldlAttrs mergeAttrs optionalAttrs;
|
||||||
|
|
||||||
importFiles = files:
|
importFiles = files:
|
||||||
map (m: pkgs.callPackage m {}) files;
|
map (m: pkgs.callPackage m {}) files;
|
||||||
|
|
||||||
mergeTests = pkgs.lib.lists.foldl pkgs.lib.trivial.mergeAttrs {};
|
mergeTests = foldl mergeAttrs {};
|
||||||
|
|
||||||
flattenAttrs = root: attrset: pkgs.lib.attrsets.foldlAttrs (acc: name: value: acc // {
|
flattenAttrs = root: attrset: foldlAttrs (acc: name: value: acc // {
|
||||||
"${root}_${name}" = value;
|
"${root}_${name}" = value;
|
||||||
}) {} attrset;
|
}) {} attrset;
|
||||||
|
|
||||||
|
@ -96,19 +97,21 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
shblib = pkgs.callPackage ./lib {};
|
shblib = pkgs.callPackage ./lib {};
|
||||||
in (rec {
|
in (optionalAttrs (system == "x86_64-linux") ({
|
||||||
modules = shblib.check {
|
modules = shblib.check {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
tests =
|
tests =
|
||||||
mergeTests (importFiles [
|
mergeTests (importFiles [
|
||||||
./test/modules/arr.nix
|
./test/modules/arr.nix
|
||||||
./test/modules/davfs.nix
|
./test/modules/davfs.nix
|
||||||
|
# TODO: Make this not use IFD
|
||||||
./test/modules/lib.nix
|
./test/modules/lib.nix
|
||||||
./test/modules/nginx.nix
|
./test/modules/nginx.nix
|
||||||
./test/modules/postgresql.nix
|
./test/modules/postgresql.nix
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# TODO: Make this not use IFD
|
||||||
lib = nix-flake-tests.lib.check {
|
lib = nix-flake-tests.lib.check {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
tests = pkgs.callPackage ./test/modules/lib.nix {};
|
tests = pkgs.callPackage ./test/modules/lib.nix {};
|
||||||
|
@ -119,7 +122,7 @@
|
||||||
// (vm_test "deluge" ./test/services/deluge.nix)
|
// (vm_test "deluge" ./test/services/deluge.nix)
|
||||||
// (vm_test "forgejo" ./test/services/forgejo.nix)
|
// (vm_test "forgejo" ./test/services/forgejo.nix)
|
||||||
// (vm_test "grocy" ./test/services/grocy.nix)
|
// (vm_test "grocy" ./test/services/grocy.nix)
|
||||||
// (vm_test "home-assistant" ./test/services/home-assistant.nix)
|
// (vm_test "homeassistant" ./test/services/home-assistant.nix)
|
||||||
// (vm_test "jellyfin" ./test/services/jellyfin.nix)
|
// (vm_test "jellyfin" ./test/services/jellyfin.nix)
|
||||||
// (vm_test "monitoring" ./test/services/monitoring.nix)
|
// (vm_test "monitoring" ./test/services/monitoring.nix)
|
||||||
// (vm_test "nextcloud" ./test/services/nextcloud.nix)
|
// (vm_test "nextcloud" ./test/services/nextcloud.nix)
|
||||||
|
@ -131,7 +134,9 @@
|
||||||
// (vm_test "postgresql" ./test/blocks/postgresql.nix)
|
// (vm_test "postgresql" ./test/blocks/postgresql.nix)
|
||||||
// (vm_test "restic" ./test/blocks/restic.nix)
|
// (vm_test "restic" ./test/blocks/restic.nix)
|
||||||
// (vm_test "ssl" ./test/blocks/ssl.nix)
|
// (vm_test "ssl" ./test/blocks/ssl.nix)
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
);
|
) // {
|
||||||
|
herculesCI.ciSystems = [ "x86_64-linux" ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue