-
Notifications
You must be signed in to change notification settings - Fork 10
92 lines (76 loc) · 2.05 KB
/
ci.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: CI
on:
pull_request:
branches:
- main
schedule:
- cron: 0 1 * * 1-5
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install Buf
uses: bufbuild/[email protected]
- name: Set up Node.js
uses: ./.github/actions/setup-node
- name: Lint code
run: npm run lint
- name: Generate protobuf code
run: npm run generate
- name: Generate docs
run: npm run docs
- name: Check for uncommitted changes
run: |-
git_status=$(git status --porcelain)
if [[ -n "${git_status}" ]]; then
echo "::error::Uncommitted changes detected"
printf "%s\n" "${git_status}"
exit 1
fi
test-matrix:
name: Generate test matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.test-matrix.outputs.matrix }}
steps:
- name: Check out code
uses: actions/checkout@v3
- id: test-matrix
name: Generate test matrix
run: scripts/test-matrix
env:
GITHUB_TOKEN: ${{ github.token }}
test:
name: Test (Cerbos ${{ matrix.cerbos }} | Node ${{ matrix.node }})
runs-on: ubuntu-latest
continue-on-error: ${{ endsWith(matrix.cerbos, '-prerelease') }}
env:
CERBOS_VERSION: ${{ matrix.cerbos }}
needs:
- test-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.test-matrix.outputs.matrix) }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Node.js
uses: ./.github/actions/setup-node
with:
node-version: ${{ matrix.node }}
- name: Start test servers
run: npm run test:servers:start
- name: Run tests
run: npm test
test-results:
name: Check test results
runs-on: ubuntu-latest
if: always()
needs:
- test
steps:
- name: Check test results
run: test "${{ needs.test.result }}" = "success"