Skip to content

Commit c39dba7

Browse files
committed
ci: [Policy Assistant] tests in github action
Signed-off-by: Hunter Gregory <[email protected]>
1 parent 88a9549 commit c39dba7

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed
+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: policy-assistant
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'release*'
8+
tags:
9+
- 'v*'
10+
paths:
11+
- 'cmd/policy-assistant/**'
12+
pull_request:
13+
branches:
14+
- 'main'
15+
- 'release*'
16+
paths:
17+
- 'cmd/policy-assistant/**'
18+
workflow_dispatch:
19+
20+
env:
21+
GO_VERSION: "1.22.0"
22+
23+
permissions: write-all
24+
25+
jobs:
26+
unit-tests:
27+
name: Unit Tests
28+
runs-on: ubuntu-22.04
29+
steps:
30+
- name: Check out code
31+
uses: actions/checkout@v2
32+
33+
- name: Set up Go
34+
uses: actions/setup-go@v4
35+
with:
36+
go-version: ${{ env.GO_VERSION }}
37+
38+
- name: Run Unit Tests
39+
run: |
40+
cd cmd/policy-assistant/
41+
go test ./...
42+
43+
build:
44+
name: Build Cyclonus
45+
runs-on: ubuntu-22.04
46+
needs: unit-tests
47+
steps:
48+
- name: Check out code
49+
uses: actions/checkout@v2
50+
51+
- name: Set up Go
52+
uses: actions/setup-go@v4
53+
with:
54+
go-version: ${{ env.GO_VERSION }}
55+
56+
- name: Build Cyclonus
57+
run: |
58+
cd cmd/policy-assistant/
59+
make cyclonus
60+
61+
- name: Save Cyclonus Binary
62+
run: |
63+
mkdir -p artifacts
64+
cp cmd/policy-assistant/cmd/cyclonus/cyclonus artifacts/
65+
uses: actions/upload-artifact@v2
66+
with:
67+
name: cyclonus-binary
68+
path: artifacts/cyclonus
69+
70+
integration-tests:
71+
name: Integration Tests
72+
runs-on: ubuntu-22.04
73+
needs: build
74+
steps:
75+
- name: Check out code
76+
uses: actions/checkout@v2
77+
78+
- name: Download Cyclonus Binary
79+
uses: actions/download-artifact@v2
80+
with:
81+
name: cyclonus-binary
82+
path: artifacts
83+
84+
- name: Run Integration Test - Explain Mode
85+
run: |
86+
artifacts/cyclonus analyze --use-example-policies --mode explain
87+
88+
- name: Run Integration Test - Probe Mode
89+
run: |
90+
artifacts/cyclonus analyze --use-example-policies --mode probe --probe-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/demo-probe.json
91+
92+
- name: Run Integration Test - Walkthrough Mode
93+
run: |
94+
artifacts/cyclonus analyze --use-example-policies --mode walkthrough

0 commit comments

Comments
 (0)