ci: throw the thing away and do something different

This commit is contained in:
Luke Granger-Brown 2024-12-29 23:54:02 +00:00
parent 02dfcb17d5
commit 0aaf795cec

View file

@ -1,31 +1,10 @@
on: [push]
jobs:
generate-targets:
runs-on: cacher
outputs:
targets: ${{ steps.build.outputs.targets }}
machines: ${{ steps.build.outputs.machines }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Drop in ops/secrets/default.nix
run:
echo "$OPS_SECRETS_DEFAULTNIX" > ops/secrets/default.nix
env:
OPS_SECRETS_DEFAULTNIX: "${{ secrets.OPS_SECRETS_DEFAULTNIX }}"
- id: build
name: Build matrix
run: |
cat "$(nix-build ci-root.nix -A forgejoMatrix)" >> "$GITHUB_OUTPUT"
build:
runs-on: cacher
needs: [generate-targets]
strategy:
matrix:
target: ${{ fromJSON(needs.generate-targets.outputs.targets) }}
system: [x86_64-linux, aarch64-linux]
steps:
- name: Checkout repository
uses: actions/checkout@v4
@ -38,24 +17,31 @@ jobs:
- name: Build
run: |
nix-build ci-root.nix -A "${{ matrix.target }}"
nix-build ci-root.nix -A linkFarm --system "${{ matrix.system }}"
build-machine:
cat result/other-systemPathJSON > system-path-${{ matrix.system }}.json
- name: Upload system paths
uses: forgejo/upload-artifact@v4
with:
name: system-paths-${{ matrix.system }}
path: system-paths-${{ matrix.system }}.json
combine-systems:
runs-on: cacher
needs: [generate-targets]
strategy:
matrix:
target: ${{ fromJSON(needs.generate-targets.outputs.machines) }}
needs: [build]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download outputs
uses: forgejo/download-artifact@v4
with:
path: system-paths
pattern: system-paths-*
- name: Drop in ops/secrets/default.nix
run: |
echo "$OPS_SECRETS_DEFAULTNIX" > ops/secrets/default.nix
env:
OPS_SECRETS_DEFAULTNIX: "${{ secrets.OPS_SECRETS_DEFAULTNIX }}"
- run: |
jq -s add system-paths/*.json > system-paths.json
- name: Build
run: |
nix-build ci-root.nix -A "machine.${{ matrix.target }}"
- name: Upload merged
uses: forgejo/upload-artifact@v4
with:
name: system-paths
path: system-paths.json