-
Notifications
You must be signed in to change notification settings - Fork 43
104 lines (91 loc) · 2.77 KB
/
ci.yml
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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.39.2
- uses: actions/checkout@v4
- run: deno fmt --check
- run: deno lint
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 21.x]
opa-version:
- 0.30.2 # last version with ABI 1.1, 0.31.0+ has ABI 1.2
- 0.41.0 # 0.35.0 is the first release with https://github.com/open-policy-agent/opa/pull/4055
steps:
- uses: actions/checkout@v4
- name: Checkout OPA v${{ matrix.opa-version }}
uses: actions/checkout@v4
with:
repository: open-policy-agent/opa
ref: v${{ matrix.opa-version }}
path: opa
- run: mkdir test/cases
- name: Prep OPA cases
working-directory: opa
# TODO(sr): This make target runs the tests, too, and we don't need
# this here. However, to untangle PRs, let's done some extra work now
# and fix this situation later.
run: make wasm-rego-test
# NOTE(sr): we've got to get rid of the opa checkout because the test
# runner would otherwise pick up any .js files it finds in there.
- name: Unpack OPA cases
run: >
tar zxvf opa/.go/cache/testcases.tar.gz --exclude='*.js' -C test/cases &&
mv opa/test/cases/testdata testdata &&
rm -rf opa/
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Open Policy Agent ${{ matrix.opa-version }}
uses: open-policy-agent/setup-opa@v2
with:
version: v${{ matrix.opa-version }}
- run: npm ci
- run: npm run build
- run: npm test
env:
OPA_CASES: test/cases/
OPA_TEST_CASES: testdata
examples-node:
name: NodeJS examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: open-policy-agent/setup-opa@v2
- uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: nodejs
run: >
npm ci
npm run build
./e2e.sh
examples-deno:
name: Deno examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: open-policy-agent/setup-opa@v2
- uses: denoland/setup-deno@v1
with:
deno-version: v1.39.2
- run: make
working-directory: examples/deno