-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (59 loc) · 2.17 KB
/
check-pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: "Build pull request"
on:
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
tests:
name: "Build ${{ matrix.target }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
target: nixosConfigurations.sandhose-desktop.config.system.build.toplevel
- os: ubuntu-22.04
target: nixosConfigurations.spaetzle.config.system.build.toplevel
- os: macos-14
target: darwinConfigurations.sandhose-laptop-m1.system
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Setup cachix
uses: cachix/cachix-action@v15
with:
name: sandhose
skipPush: true
extraPullNames: nix-community
- name: Build system
env:
TARGET: "github:${{ github.repository }}/${{ github.ref }}#${{ matrix.target }}"
run: nix build $TARGET --fallback --log-format raw --print-build-logs
- name: Garbage collect build dependencies
run: nix-collect-garbage
- name: Fetch old system to profile
env:
TARGET: "github:${{ github.repository }}/${{ github.base_ref }}#${{ matrix.target }}"
run: nix build $TARGET --log-format raw --print-build-logs --profile ./profile
- name: Add new system to profile
env:
TARGET: "github:${{ github.repository }}/${{ github.ref }}#${{ matrix.target }}"
run: nix build $TARGET --log-format raw --print-build-logs --profile ./profile
- name: Diff profile
id: diff
run: |
delimiter="$(openssl rand -hex 16)"
echo "diff<<${delimiter}" >> "${GITHUB_OUTPUT}"
nix profile diff-closures --profile ./profile | perl -pe 's/\e\[[0-9;]*m(?:\e\[K)?//g' >> "${GITHUB_OUTPUT}"
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
- name: Comment PR
uses: marocchino/sticky-pull-request-comment@v2
with:
header: ".#${{ matrix.target }}"
message: |
### Diff of `${{ matrix.target }}`
```
${{ steps.diff.outputs.diff }}
```