generated from kubewarden/go-policy-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from kubewarden/reusable-workflows
Use GHA reusable workflows from kubewarden/github-actions
- Loading branch information
Showing
5 changed files
with
53 additions
and
176 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
|
||
name: Release policy | ||
|
||
jobs: | ||
|
||
test: | ||
name: run tests and linters | ||
uses: kubewarden/github-actions/.github/workflows/reusable-test-policy-go.yml@v1 | ||
|
||
release: | ||
needs: test | ||
permissions: | ||
# Required to push to GHCR | ||
contents: read | ||
# Required to create GH releases | ||
packages: write | ||
# Required by cosign keyless signing | ||
id-token: write | ||
|
||
uses: kubewarden/github-actions/.github/workflows/reusable-release-policy-go.yml@v1 | ||
with: | ||
oci-target: ghcr.io/${{ github.repository_owner }}/policies/volumes-psp | ||
secrets: | ||
workflow-pat: ${{ secrets.WORKFLOW_PAT }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
on: [push, pull_request] | ||
name: Continuous integration | ||
jobs: | ||
test: | ||
name: run tests and linters | ||
uses: kubewarden/github-actions/.github/workflows/reusable-test-policy-go.yml@v1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
wasm: go.mod go.sum *.go | ||
docker run --rm -v ${PWD}:/src -w /src tinygo/tinygo:0.18.0 tinygo build -o policy.wasm -target=wasi -no-debug . | ||
SOURCE_FILES := $(shell find . -type f -name '*.go') | ||
|
||
annotate: | ||
kwctl annotate -m metadata.yml -o annotated.wasm policy.wasm | ||
policy.wasm: $(SOURCE_FILES) go.mod go.sum | ||
docker run --rm -v ${PWD}:/src -w /src tinygo/tinygo:0.18.0 tinygo build \ | ||
-o policy.wasm -target=wasi -no-debug . | ||
|
||
annotated-policy.wasm: policy.wasm metadata.yml | ||
kwctl annotate -m metadata.yml -o annotated-policy.wasm policy.wasm | ||
|
||
.PHONY: test | ||
test: | ||
go test -v | ||
|
||
e2e-tests: | ||
.PHONY: e2e-tests | ||
e2e-tests: annotated-policy.wasm | ||
bats e2e.bats | ||
|
||
.PHONY: clean | ||
clean: | ||
go clean | ||
rm -f policy.wasm | ||
rm -f policy.wasm annotated-policy.wasm |
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