-
Notifications
You must be signed in to change notification settings - Fork 4
116 lines (104 loc) · 2.96 KB
/
build.yml
File metadata and controls
116 lines (104 loc) · 2.96 KB
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
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
code:
- '**'
- '!**/*.md'
- '!docs/**'
build-matrix:
needs: changes
if: needs.changes.outputs.code == 'true'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
env:
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/architect/.zig-cache
ZIG_LOCAL_CACHE_DIR: ${{ github.workspace }}/architect/.zig-cache/local
steps:
- uses: actions/checkout@v6
with:
path: architect
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Cache Zig package cache
uses: actions/cache@v5
with:
path: architect/.zig-cache
key: zig-${{ runner.os }}-${{ hashFiles('architect/build.zig.zon') }}
restore-keys: |
zig-${{ runner.os }}-
- name: Cache Nix store
uses: cachix/cachix-action@v17
with:
name: forketyfork
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Prefetch Zig dependencies
run: |
for i in 1 2 3; do
nix develop --accept-flake-config --command just setup && break
if [ $i -eq 3 ]; then exit 1; fi
sleep 5
done
working-directory: architect
- name: Build
run: |
for i in 1 2 3; do
nix develop --accept-flake-config --command just build && break
if [ $i -eq 3 ]; then exit 1; fi
sleep 5
done
working-directory: architect
- name: Test
run: |
for i in 1 2 3; do
nix develop --accept-flake-config --command just test && break
if [ $i -eq 3 ]; then exit 1; fi
sleep 5
done
working-directory: architect
- name: Lint
run: |
for i in 1 2 3; do
nix develop --accept-flake-config --command just lint && break
if [ $i -eq 3 ]; then exit 1; fi
sleep 5
done
working-directory: architect
build:
name: build
needs: [changes, build-matrix]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check result
run: |
if [[ "${{ needs.changes.outputs.code }}" == "false" ]]; then
echo "Documentation-only change, skipping build"
exit 0
fi
if [[ "${{ needs.build-matrix.result }}" == "success" ]]; then
echo "Build succeeded"
exit 0
fi
echo "Build failed"
exit 1