From fcd3946dd591efc204b6d9543c11faed4cbfbf6c Mon Sep 17 00:00:00 2001 From: Daniel Baker Date: Sat, 21 Sep 2024 19:51:03 -0700 Subject: [PATCH] ci: add package and nixos config builds Only 1 package and 0 nixos configurations where being built in CI. Now they all are. --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3950f2c3..14c9130f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,8 @@ on: - master workflow_dispatch: jobs: - validate_datafiles: - name: ci_core + nix_checks: + name: nix checks runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -18,4 +18,43 @@ jobs: - run: nix build -L .#checks.x86_64-linux.perl-switches - run: nix build -L .#checks.x86_64-linux.openwrt-golden - run: nix build -L .#checks.x86_64-linux.formatting + nix_builds: + name: nix builds + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - run: nix build -L .#massflash - run: nix build -L .#scaleInventory + - run: nix build -L .#serverspec + nixos_configs_get: + name: nixos configurations get name + runs-on: ubuntu-latest + outputs: + nixosconfignames: ${{ steps.nixosconfigsget.outputs.nixosconfignames }} + steps: + - uses: actions/checkout@v3 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Get all NixOS configurations + id: nixosconfigsget + run: | + nixosconfignames=$(nix eval .\#nixosConfigurations --apply builtins.attrNames --json) + echo "$nixosconfignames" + echo "nixosconfignames=$nixosconfignames" >> $GITHUB_OUTPUT + nixos_configs_build: + name: build ${{ matrix.configName }} nixos configuration + needs: nixos_configs_get + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + configName: ${{ fromJSON(needs.nixos_configs_get.outputs.nixosconfignames) }} + steps: + - uses: actions/checkout@v3 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Build ${{ matrix.configName }} nixos configuration + run: | + nix build -L .#nixosConfigurations.${{ matrix.configName }}.config.system.build.toplevel