Test with action
This commit is contained in:
parent
439ce6d466
commit
bc419eae7f
1 changed files with 35 additions and 6 deletions
|
|
@ -11,7 +11,7 @@ jobs:
|
||||||
runs-on: nix
|
runs-on: nix
|
||||||
outputs:
|
outputs:
|
||||||
changed: ${{ steps.changes.outputs.changed }}
|
changed: ${{ steps.changes.outputs.changed }}
|
||||||
hosts: ${{ steps.hosts.outputs.hosts }}
|
hosts: ${{ steps.hosts.outputs.hosts || '[]' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -39,9 +39,22 @@ jobs:
|
||||||
id: hosts
|
id: hosts
|
||||||
if: steps.changes.outputs.changed == 'true'
|
if: steps.changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
HOSTS=$(nix eval --json .#colmena --apply 'x: builtins.filter (n: n != "meta" && builtins.elem "lxc" (x.${n}.deployment.tags or [])) (builtins.attrNames x)')
|
set -euo pipefail
|
||||||
|
HOSTS=$(nix eval --json .#colmena --apply 'x: builtins.filter (n: n != "meta" && builtins.elem "lxc" (x.${n}.deployment.tags or [])) (builtins.attrNames x)' 2>&1) || {
|
||||||
|
echo "Failed to evaluate colmena hosts"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
# Validate the output is a non-empty JSON array
|
||||||
|
if ! echo "$HOSTS" | jq -e '. | if type == "array" and length > 0 then true else false end' > /dev/null 2>&1; then
|
||||||
|
echo "Error: No LXC hosts found or invalid JSON output: $HOSTS"
|
||||||
|
echo "hosts=[]" >> $GITHUB_OUTPUT
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
echo "hosts=$HOSTS" >> $GITHUB_OUTPUT
|
echo "hosts=$HOSTS" >> $GITHUB_OUTPUT
|
||||||
echo "Discovered hosts: $HOSTS"
|
echo "Discovered hosts: $HOSTS"
|
||||||
|
# Verify output was set
|
||||||
|
echo "DEBUG: GITHUB_OUTPUT contents:"
|
||||||
|
cat $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Upload flake.lock
|
- name: Upload flake.lock
|
||||||
if: steps.changes.outputs.changed == 'true'
|
if: steps.changes.outputs.changed == 'true'
|
||||||
|
|
@ -53,13 +66,21 @@ jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: check-updates
|
needs: check-updates
|
||||||
if: needs.check-updates.outputs.changed == 'true'
|
if: needs.check-updates.outputs.changed == 'true' && needs.check-updates.outputs.hosts != '[]' && needs.check-updates.outputs.hosts != ''
|
||||||
runs-on: nix
|
runs-on: nix
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
host: ${{ fromJson(needs.check-updates.outputs.hosts) }}
|
host: ${{ fromJson(needs.check-updates.outputs.hosts || '[]') }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Debug - show received values
|
||||||
|
run: |
|
||||||
|
echo "=== DEBUG: Values received from check-updates job ==="
|
||||||
|
echo "needs.check-updates.outputs.changed = '${{ needs.check-updates.outputs.changed }}'"
|
||||||
|
echo "needs.check-updates.outputs.hosts = '${{ needs.check-updates.outputs.hosts }}'"
|
||||||
|
echo "matrix.host = '${{ matrix.host }}'"
|
||||||
|
echo "=== END DEBUG ==="
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
|
@ -71,8 +92,16 @@ jobs:
|
||||||
- name: Build ${{ matrix.host }}
|
- name: Build ${{ matrix.host }}
|
||||||
id: build
|
id: build
|
||||||
run: |
|
run: |
|
||||||
echo "Building host: ${{ matrix.host }}"
|
HOST="${{ matrix.host }}"
|
||||||
nix build .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel --no-link 2>&1 | tee build-output.txt
|
echo "DEBUG: matrix.host='$HOST'"
|
||||||
|
echo "DEBUG: raw matrix.host='${{ matrix.host }}'"
|
||||||
|
if [ -z "$HOST" ]; then
|
||||||
|
echo "Error: Host name is empty"
|
||||||
|
echo "This usually means the 'hosts' output from check-updates job was not received properly"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Building host: $HOST"
|
||||||
|
nix build ".#nixosConfigurations.${HOST}.config.system.build.toplevel" --no-link 2>&1 | tee build-output.txt
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Upload build log on failure
|
- name: Upload build log on failure
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue