forgejo actions: copy gh improvements, maybe?
parent
7425859788
commit
1f38b8529c
|
@ -1,63 +1,52 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
get-x86_64-hosts:
|
||||
get-hosts:
|
||||
runs-on: self-hosted-x86_64-linux
|
||||
outputs:
|
||||
hosts: ${{ steps.output-hosts.outputs.hosts }}
|
||||
matrix: ${{ steps.hosts_out.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: output-hosts
|
||||
- name: repository checkout
|
||||
uses: actions/checkout@v4
|
||||
- id: hosts_out
|
||||
name: set hosts var
|
||||
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}"
|
||||
{
|
||||
echo -n "matrix="
|
||||
nix eval --raw --impure --expr '
|
||||
let
|
||||
f = configs: builtins.groupBy (n: configs.${n}.pkgs.system) (builtins.attrNames configs);
|
||||
in
|
||||
builtins.toJSON (f (builtins.getFlake(builtins.toString ./.)).outputs.nixosConfigurations)'
|
||||
echo ""
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
get-aarch64-hosts:
|
||||
runs-on: self-hosted-aarch64-linux
|
||||
outputs:
|
||||
hosts: ${{ steps.output-hosts.outputs.hosts }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- 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:
|
||||
x86_64-linux:
|
||||
runs-on: self-hosted-x86_64-linux
|
||||
needs: get-x86_64-hosts
|
||||
needs: [get-hosts]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
host: ${{fromJSON(needs.get-x86_64-hosts.outputs.hosts)}}
|
||||
host: ${{ fromJson(needs.get-hosts.outputs.matrix).x86_64-linux }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: repository checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: build host configuration ${{ matrix.host }}
|
||||
run: |
|
||||
nixos-rebuild build --verbose --flake ".#${{ matrix.host }}"
|
||||
run: nixos-rebuild build --verbose --flake ".#${{ matrix.host }}"
|
||||
|
||||
build-nixos-aarch64-linux:
|
||||
aarch64-linux:
|
||||
runs-on: self-hosted-aarch64-linux
|
||||
needs: get-aarch64-hosts
|
||||
needs: [get-hosts]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
host: ${{fromJSON(needs.get-aarch64-hosts.outputs.hosts)}}
|
||||
host: ${{ fromJson(needs.get-hosts.outputs.matrix).aarch64-linux }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: repository checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: build host configuration ${{ matrix.host }}
|
||||
run: |
|
||||
nixos-rebuild build --verbose --flake ".#${{ matrix.host }}"
|
||||
run: nixos-rebuild build --verbose --flake ".#${{ matrix.host }}"
|
||||
|
|
Loading…
Reference in New Issue