Skip to content

Commit

Permalink
ci: rework into using a job matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
arachnist committed Feb 25, 2024
1 parent ccc1772 commit 5b24182
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions .forgejo/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,58 @@ on:
branches: [main]

jobs:
nixos-x86_64-linux:
get-x86_64-hosts:
runs-on: self-hosted-x86_64-linux
outputs:
hosts: ${{ steps.output-hosts.outputs.hosts }}
steps:
- uses: actions/checkout@v3
- run: ./.ci.sh
# - run: ./.ci.sdImages.sh
- name: output-hosts
run: |
HOSTS_JSON="$(nix eval -I nixpkgs=$(nix flake metadata nixpkgs --json | jq -r .path) --raw --impure --expr '
with import <nixpkgs> { };
builtins.toJSON (lib.mapAttrsToList (n: v: n)
(lib.attrsets.filterAttrs (n: v: v.pkgs.system == pkgs.system)
(builtins.getFlake(builtins.toString ./.)).outputs.nixosConfigurations))'
)"
echo "::set-output name=hosts::${HOSTS_JSON}"
nixos-aarch64-linux:
get-aarch64-hosts:
runs-on: self-hosted-aarch64-linux
outputs:
hosts: ${{ steps.output-hosts.outputs.hosts }}
steps:
- uses: actions/checkout@v3
- run: ./.ci.sh
# - run: ./.ci.sdImages.sh
- name: output-hosts
run: |
HOSTS_JSON="$(nix eval -I nixpkgs=$(nix flake metadata nixpkgs --json | jq -r .path) --raw --impure --expr '
with import <nixpkgs> { };
builtins.toJSON (lib.mapAttrsToList (n: v: n)
(lib.attrsets.filterAttrs (n: v: v.pkgs.system == pkgs.system)
(builtins.getFlake(builtins.toString ./.)).outputs.nixosConfigurations))'
)"
echo "::set-output name=hosts::${HOSTS_JSON}"
build-nixos-x86_64-linux:
runs-on: self-hosted-x86_64-linux
needs: get-x86_64-hosts
strategy:
matrix:
host: ${{fromJSON(needs.get-x86_64-hosts.outputs.hosts)}}
steps:
- uses: actions/checkout@v3
- name: build host configuration ${{ matrix.host }}
run: |
nixos-rebuild build --verbose --flake ".#${{ matrix.host }}"
build-nixos-aarch64-linux:
runs-on: self-hosted-aarch64-linux
needs: get-aarch64-hosts
strategy:
matrix:
host: ${{fromJSON(needs.get-aarch64-hosts.outputs.hosts)}}
steps:
- uses: actions/checkout@v3
- name: build host configuration ${{ matrix.host }}
run: |
nixos-rebuild build --verbose --flake ".#${{ matrix.host }}"

0 comments on commit 5b24182

Please sign in to comment.