Skip to content

Commit

Permalink
Merge pull request socallinuxexpo#783 from socallinuxexpo/rh/issue-781
Browse files Browse the repository at this point in the history
[READY] - gha: limit nixos builds to master and manual
  • Loading branch information
sarcasticadmin authored Sep 27, 2024
2 parents 25abe86 + ce6a9bc commit ef74408
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 30 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci-nixos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: ci-nixos
on:
push: # This is only run when PRs are merged into master
branches:
- master
workflow_dispatch:
# These jobs can take a long time and potentially cause us to bump up against CI
# rate limits. Instead we've opted to run these only on merges to master. We might
# have to limit these further if the rate limiting remains
jobs:
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
30 changes: 0 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,3 @@ jobs:
- 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

0 comments on commit ef74408

Please sign in to comment.