chore: [Policy Assistant] rename Cyclonus to policy-assistant #36
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: policy-assistant | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'release*' | |
tags: | |
- 'v*' | |
paths: | |
- 'cmd/policy-assistant/**' | |
- '.github/workflows/policy-assistant.yml' | |
pull_request: | |
branches: | |
- 'main' | |
- 'release*' | |
paths: | |
- 'cmd/policy-assistant/**' | |
- '.github/workflows/policy-assistant.yml' | |
workflow_dispatch: | |
env: | |
GO_VERSION: "1.22.0" | |
permissions: write-all | |
jobs: | |
go-tests: | |
name: Go Tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run Unit Tests | |
run: | | |
cd cmd/policy-assistant/ | |
go test ./... | |
- name: Run Go Vet | |
run: | | |
cd cmd/policy-assistant/ | |
go vet ./... | |
- name: Run Go Fmt | |
shell: bash | |
run: | | |
cd cmd/policy-assistant/ | |
exitCode=0 | |
go fmt ./... | grep "\.go" || exitCode=$? | |
if [[ $exitCode == 0 ]]; then | |
echo "please run 'make fmt' in the cmd/policy-assistant/ directory" | |
exit 1 | |
else | |
echo "go files are properly formatted" | |
fi | |
build: | |
name: Build Policy Assistant | |
runs-on: ubuntu-22.04 | |
needs: go-tests | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build pola Binary | |
run: | | |
cd cmd/policy-assistant/ | |
make pola | |
- name: Save pola Binary | |
run: | | |
mkdir -p artifacts | |
cp cmd/policy-assistant/cmd/pola/pola artifacts/ | |
- name: Upload pola Binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pola-binary | |
path: artifacts/pola | |
integration-tests: | |
name: Integration Tests | |
runs-on: ubuntu-22.04 | |
needs: build | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Download pola Binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: pola-binary | |
path: artifacts | |
- name: Set pola Binary Permissions | |
run: chmod u+x artifacts/pola | |
- name: Run Integration Test - Explain Mode | |
run: | | |
artifacts/pola analyze --mode explain --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/ | |
- name: Run Integration Test - Probe Mode | |
run: | | |
artifacts/pola analyze --mode probe --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/ --probe-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/demo-probe.json | |
- name: Run Integration Test - Walkthrough Mode | |
run: | | |
artifacts/pola analyze --mode walkthrough --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/ |