-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (139 loc) · 4.46 KB
/
ci.yml
File metadata and controls
148 lines (139 loc) · 4.46 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
id-token: write
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
fmt-check:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Check formatting
run: nix develop .#ci --command zig fmt --check src/ tests/ bench/ build.zig
unit-tests:
name: Unit Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Cache Zig build artifacts
uses: actions/cache@v4
with:
path: |
.zig-cache
~/.cache/zig
key: zig-unit-${{ matrix.os }}-${{ hashFiles('build.zig', 'build.zig.zon', 'src/**') }}
restore-keys: |
zig-unit-${{ matrix.os }}-
- name: Run unit tests
run: nix develop .#ci --command zig build test --summary all
smoke-tests:
name: Smoke Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Cache Zig build artifacts
uses: actions/cache@v4
with:
path: |
.zig-cache
~/.cache/zig
key: zig-smoke-${{ matrix.os }}-${{ hashFiles('build.zig', 'build.zig.zon', 'src/**') }}
restore-keys: |
zig-smoke-${{ matrix.os }}-
- name: Start OpenSearch
run: nix develop .#ci --command es-start
- name: Run smoke tests
run: nix develop .#ci --command zig build test-smoke --summary all
env:
ES_URL: http://localhost:9200
- name: Stop OpenSearch
if: always()
run: nix develop .#ci --command es-stop
integration-tests:
name: Integration Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: [unit-tests]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Cache Zig build artifacts
uses: actions/cache@v4
with:
path: |
.zig-cache
~/.cache/zig
key: zig-integration-${{ matrix.os }}-${{ hashFiles('build.zig', 'build.zig.zon', 'src/**', 'tests/**') }}
restore-keys: |
zig-integration-${{ matrix.os }}-
- name: Start OpenSearch
run: nix develop .#ci --command es-start
- name: Run integration tests
run: nix develop .#ci --command zig build test-integration --summary all
env:
ES_URL: http://localhost:9200
- name: Stop OpenSearch
if: always()
run: nix develop .#ci --command es-stop
examples-build:
name: Examples Build
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Cache Zig build artifacts
uses: actions/cache@v4
with:
path: |
.zig-cache
~/.cache/zig
examples/.zig-cache
examples/~/.cache/zig
key: zig-examples-${{ hashFiles('build.zig', 'build.zig.zon', 'src/**', 'examples/**') }}
restore-keys: |
zig-examples-
- name: Build examples
run: cd examples && nix develop ..#ci --command zig build
build-check:
name: Build Check (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Nix build (reproducible)
run: nix build
- name: Nix flake check
run: nix flake check