ci: checkout via Nix rather than action (#280)

This is closer to how users would install Stylix. It may also be
slightly faster since there's one less action to process.
This commit is contained in:
Daniel Thwaites 2024-03-13 10:52:34 +00:00 committed by GitHub
parent d0b264e216
commit 1adbaaf45c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 12 deletions

View file

@ -3,6 +3,9 @@ name: Build
on:
pull_request:
permissions:
contents: read
jobs:
evaluate:
name: List packages
@ -19,13 +22,10 @@ jobs:
- name: Set up cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Checkout repository
uses: actions/checkout@v4
- name: List packages
id: list-packages
run: |
nix flake show . --json | jq -rc 'to_entries | map(.key as $type | select($type == "checks" or $type == "packages") | .value | to_entries | map(.key as $arch | select($arch == "x86_64-linux" or $arch == "x86_64-darwin") | .value | to_entries | map({type: $type, arch: $arch, os: (if $arch == "x86_64-linux" then "ubuntu-latest" else "macos-latest" end), key: .key})) | flatten) | flatten | "packages=\(.)"' >> $GITHUB_OUTPUT
nix flake show github:${{ github.repository }}/${{ github.event.pull_request.head.sha || github.sha }} --json | jq -rc 'to_entries | map(.key as $type | select($type == "checks" or $type == "packages") | .value | to_entries | map(.key as $arch | select($arch == "x86_64-linux" or $arch == "x86_64-darwin") | .value | to_entries | map({type: $type, arch: $arch, os: (if $arch == "x86_64-linux" then "ubuntu-latest" else "macos-latest" end), key: .key})) | flatten) | flatten | "packages=\(.)"' >> $GITHUB_OUTPUT
outputs:
packages: ${{ steps.list-packages.outputs.packages }}
@ -53,8 +53,5 @@ jobs:
- name: Set up cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Checkout repository
uses: actions/checkout@v4
- name: Build ${{ matrix.build.key }}
run: nix -L build .#${{ matrix.build.type }}.${{ matrix.build.arch }}.${{ matrix.build.key }}
run: nix -L build github:${{ github.repository }}/${{ github.event.pull_request.head.sha || github.sha }}#${{ matrix.build.type }}.${{ matrix.build.arch }}.${{ matrix.build.key }}

View file

@ -25,11 +25,8 @@ jobs:
- name: Set up cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Checkout repository
uses: actions/checkout@v4
- name: Build docs
run: nix -L build .#docs
run: nix -L build github:${{ github.repository }}/${{ github.sha }}#docs
- name: Prepare docs for upload
run: cp -r --dereference --no-preserve=mode,ownership result/ public/