Expose Policy Examples as Go Module #208
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
regal-check: | |
name: Regal Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Regal | |
uses: StyraInc/setup-regal@v1 | |
with: | |
version: v0.11.0 | |
- run: regal lint --format=github . | |
syntax-check: | |
name: Syntax Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Install OPA | |
uses: open-policy-agent/setup-opa@v2 | |
with: | |
version: 0.64.0 | |
- name: Check syntax | |
run: | | |
# KLUDGE: plan/check-sanitized-value.rego needs to be ignored because it uses the custom sanitized() function | |
find . -name \*.rego ! -regex '.*_test\.rego$' ! -path './examples/plan/check-sanitized-value.rego' -print0 | xargs -0 -n1 opa check --strict | |
opa-test: | |
name: OPA Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Install OPA | |
uses: open-policy-agent/setup-opa@v2 | |
with: | |
version: 0.64.0 | |
- name: Run unit tests | |
run: | | |
tests=$(find . -type f -name '*_test\.rego') | |
for test in $tests; do | |
opa test -v $test ${test/_test.rego/.rego} | |
done | |
go-test: | |
name: Go Tests | |
runs-on: ubuntu-latest | |
container: golang:1.23.3 | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Run unit tests | |
run: go test -v ./... |