chore!: 2025-01-04 22:52:58 +0100 #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Check | |
on: # yamllint disable-line rule:truthy | |
push: | |
permissions: | |
contents: read | |
jobs: | |
get-derivations: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} | |
# TODO: Handle weird file names. Store in JSON. | |
- id: get-changed-files | |
run: | | |
if ${{ github.event_name == 'pull_request' }}; then | |
git diff --name-only HEAD~1 HEAD | |
else | |
git diff --name-only \ | |
${{ github.event.before }} ${{ github.event.after }} | |
fi | | |
jq --raw-input --raw-output --slurp ' | |
split("\n")[:-1] | "changed_files=\(.)" | |
' \ | |
>> $GITHUB_OUTPUT | |
- run: | | |
for file in ${{ | |
fromJSON(steps.get-changed-files.outputs.changed_files) | |
}}; do | |
printf '[CHANGED FILE] %s\n' "$file" | |
done | |
- uses: DeterminateSystems/nix-installer-action@v16 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- id: get-derivations | |
run: | | |
nix flake show --json \ | |
github:${{ | |
github.repository | |
}}/${{ | |
github.event.pull_request.head.sha || github.sha | |
}} | | |
jq --raw-output ' | |
def format_output($arch; $type): | |
{ | |
arch: $arch, | |
key: ., | |
os: ( | |
if $arch == "x86_64-linux" then | |
"ubuntu-24.04" | |
else | |
"macos-14" | |
end | |
), | |
type: $type | |
}; | |
[ | |
["x86_64-linux", "x86_64-darwin"][] as $arch | | |
(.checks[$arch] | keys) as $checks | | |
(.packages[$arch] | keys) as $packages | | |
(($checks - $packages)[] | format_output($arch; "checks")), | |
($packages[] | format_output($arch; "packages")) | |
] | | |
"derivations=\(.)" | |
' >> $GITHUB_OUTPUT | |
outputs: | |
derivations: ${{ steps.get-derivations.outputs.derivations }} | |
# check: | |
# runs-on: ${{ matrix.check.os }} | |
# | |
# name: ${{ matrix.check.key }} on ${{ matrix.check.arch }} | |
# needs: get-derivations | |
# | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# check: ${{ fromJSON(needs.get-derivations.outputs.derivations) }} | |
# | |
# steps: | |
# - uses: DeterminateSystems/nix-installer-action@v16 | |
# - uses: DeterminateSystems/magic-nix-cache-action@v8 | |
# | |
# - run: | | |
# nix build --no-update-lock-file --print-build-logs \ | |
# github:${{ | |
# github.repository | |
# }}/${{ | |
# github.event.pull_request.head.sha || github.sha | |
# }}#${{ | |
# matrix.check.type | |
# }}.${{ | |
# matrix.check.arch | |
# }}.${{ | |
# matrix.check.key | |
# }} |