aboutsummaryrefslogtreecommitdiffhomepage
path: root/.gitea/workflows/test.yml
blob: 71cb09e8506c7e9e5c440c6aa22df46688e8c402 (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Test

on:
  - push

jobs:
  hakurei:
    name: Hakurei
    runs-on: nix
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Run NixOS test
        run: nix build --out-link "result" --print-out-paths --print-build-logs .#checks.x86_64-linux.hakurei

      - name: Upload test output
        uses: actions/upload-artifact@v3
        with:
          name: "hakurei-vm-output"
          path: result/*
          retention-days: 1

  race:
    name: Hakurei (race detector)
    runs-on: nix
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Run NixOS test
        run: nix build --out-link "result" --print-out-paths --print-build-logs .#checks.x86_64-linux.race

      - name: Upload test output
        uses: actions/upload-artifact@v3
        with:
          name: "hakurei-race-vm-output"
          path: result/*
          retention-days: 1

  sandbox:
    name: Sandbox
    runs-on: nix
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Run NixOS test
        run: nix build --out-link "result" --print-out-paths --print-build-logs .#checks.x86_64-linux.sandbox

      - name: Upload test output
        uses: actions/upload-artifact@v3
        with:
          name: "sandbox-vm-output"
          path: result/*
          retention-days: 1

  sandbox-race:
    name: Sandbox (race detector)
    runs-on: nix
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Run NixOS test
        run: nix build --out-link "result" --print-out-paths --print-build-logs .#checks.x86_64-linux.sandbox-race

      - name: Upload test output
        uses: actions/upload-artifact@v3
        with:
          name: "sandbox-race-vm-output"
          path: result/*
          retention-days: 1

  hpkg:
    name: Hpkg
    runs-on: nix
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Run NixOS test
        run: nix build --out-link "result" --print-out-paths --print-build-logs .#checks.x86_64-linux.hpkg

      - name: Upload test output
        uses: actions/upload-artifact@v3
        with:
          name: "hpkg-vm-output"
          path: result/*
          retention-days: 1

  check:
    name: Flake checks
    needs:
      - hakurei
      - race
      - sandbox
      - sandbox-race
      - hpkg
    runs-on: nix
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Run checks
        run: nix --print-build-logs --experimental-features 'nix-command flakes' flake check

  dist:
    name: Create distribution
    runs-on: nix
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Build for test
        id: build-test
        run: >-
          export HAKUREI_REV="$(git rev-parse --short HEAD)" &&
          sed -i.old 's/version = /version = "0.0.0-'$HAKUREI_REV'"; # version = /' package.nix &&
          nix build --print-out-paths --print-build-logs .#dist &&
          mv package.nix.old package.nix &&
          echo "rev=$HAKUREI_REV" >> $GITHUB_OUTPUT

      - name: Upload test build
        uses: actions/upload-artifact@v3
        with:
          name: "hakurei-${{ steps.build-test.outputs.rev }}"
          path: result/*
          retention-days: 1