add Gatekeeper validation to manifests (#212) #700
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: Unit Tests | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '~1.22' | |
cache-dependency-path: "**/*.sum" | |
- name: Create kubebuilder directory | |
# The default location for the etcd and kube-apiserver binaries is /kubebuilder/bin | |
run: sudo mkdir -p /usr/local/kubebuilder/bin | |
- name: Install etcd | |
run: | | |
wget -q https://github.com/etcd-io/etcd/releases/download/v3.5.0/etcd-v3.5.0-linux-amd64.tar.gz | |
tar xzf etcd-v3.5.0-linux-amd64.tar.gz | |
sudo mv etcd-v3.5.0-linux-amd64/etcd /usr/local/kubebuilder/bin/ | |
- name: Install kube-apiserver | |
run: | | |
wget -q https://storage.googleapis.com/kubernetes-release/release/v1.22.2/bin/linux/amd64/kube-apiserver | |
chmod +x kube-apiserver | |
sudo mv kube-apiserver /usr/local/kubebuilder/bin/ | |
- name: Run Unit Tests | |
run: go test -race -v ./... -coverprofile=coverage.out | |
- name: Convert coverage to lcov | |
uses: jandelgado/gcov2lcov-action@c680c0f7c7442485f1749eb2a13e54a686e76eb5 #v1.0.8 | |
- name: Coveralls | |
uses: coverallsapp/github-action@95b1a2355bd0e526ad2fd62da9fd386ad4c98474 #v2.2.1 | |
with: | |
flag-name: unit-test | |
path-to-lcov: coverage.lcov |