Update RHTAP references #1359
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: KinD tests | |
on: | |
push: | |
branches: | |
- main | |
- release-[0-9]+.[0-9]+ | |
pull_request: | |
branches: | |
- main | |
- release-[0-9]+.[0-9]+ | |
env: | |
RELEASE_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }} | |
defaults: | |
run: | |
shell: bash | |
working-directory: governance-policy-propagator | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
name: Unit Tests | |
steps: | |
- name: Checkout Governance Policy Propagator | |
uses: actions/checkout@v3 | |
with: | |
path: governance-policy-propagator | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: governance-policy-propagator/go.mod | |
- name: Verify modules | |
run: | | |
go mod verify | |
- name: Verify format | |
run: | | |
make fmt | |
git diff --exit-code | |
make lint | |
- name: Verify deploy/operator.yaml | |
run: | | |
make generate | |
make generate-operator-yaml | |
git diff --exit-code | |
- name: Unit and Integration Tests | |
run: | | |
make test | |
- name: Unit Test Coverage | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
make test-coverage | |
- name: Upload Unit Test Coverage | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_unit | |
path: governance-policy-propagator/coverage_unit.out | |
kind-tests: | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY: localhost:5000 | |
strategy: | |
fail-fast: false | |
matrix: | |
# Run tests on minimum and newest supported OCP Kubernetes | |
# The "minimum" tag is set in the Makefile | |
# KinD tags: https://hub.docker.com/r/kindest/node/tags | |
kind: | |
- 'minimum' | |
- 'latest' | |
name: KinD tests | |
steps: | |
- name: Checkout Governance Policy Propagator | |
uses: actions/checkout@v3 | |
with: | |
path: governance-policy-propagator | |
- name: Create K8s KinD Cluster - ${{ matrix.kind }} | |
env: | |
KIND_VERSION: ${{ matrix.kind }} | |
run: | | |
make kind-bootstrap-cluster-dev | |
- name: E2E Tests | |
run: | | |
export GOPATH=$(go env GOPATH) | |
make e2e-test-coverage | |
- name: Upload E2E Test Coverage | |
if: ${{ github.event_name == 'pull_request' && matrix.kind == 'latest'}} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_e2e | |
path: governance-policy-propagator/coverage_e2e.out | |
- name: E2E Tests for Compliance Events API | |
run: | | |
make postgres | |
make e2e-test-coverage-compliance-events-api | |
- name: Upload Compliance Events API Test Coverage | |
if: ${{ github.event_name == 'pull_request' && matrix.kind == 'latest'}} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_e2e_compliance_events_api | |
path: governance-policy-propagator/coverage_e2e_compliance_events_api.out | |
- name: Debug | |
if: ${{ failure() }} | |
run: | | |
make e2e-debug | |
- name: E2E Tests for Webhook | |
run: | | |
make webhook | |
make build-images | |
make kind-deploy-controller-dev | |
make e2e-test-webhook | |
- name: Clean up cluster | |
if: ${{ always() }} | |
run: | | |
make kind-delete-cluster | |
policyautomation-tests: | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY: localhost:5000 | |
strategy: | |
fail-fast: false | |
matrix: | |
# Run tests on minimum and newest supported OCP Kubernetes | |
# The "minimum" tag is set in the Makefile | |
# KinD tags: https://hub.docker.com/r/kindest/node/tags | |
kind: | |
- 'minimum' | |
- 'latest' | |
name: PolicyAutomation tests | |
steps: | |
- name: Checkout Governance Policy Propagator | |
uses: actions/checkout@v3 | |
with: | |
path: governance-policy-propagator | |
- name: Create K8s KinD Cluster - ${{ matrix.kind }} | |
env: | |
KIND_VERSION: ${{ matrix.kind }} | |
run: | | |
make kind-bootstrap-cluster-dev | |
- name: PolicyAutomation E2E Tests | |
run: | | |
export GOPATH=$(go env GOPATH) | |
make e2e-test-coverage-policyautomation | |
- name: Upload PolicyAutomation Test Coverage | |
if: ${{ github.event_name == 'pull_request' && matrix.kind == 'latest'}} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_e2e_policyautomation | |
path: governance-policy-propagator/coverage_e2e_policyautomation.out | |
- name: Debug | |
if: ${{ failure() }} | |
run: | | |
make e2e-debug | |
- name: Clean up cluster | |
if: ${{ always() }} | |
run: | | |
make kind-delete-cluster | |
coverage-verification: | |
defaults: | |
run: | |
working-directory: '.' | |
runs-on: ubuntu-latest | |
name: Test Coverage Verification | |
if: ${{ github.event_name == 'pull_request' }} | |
needs: [unit-tests, kind-tests, policyautomation-tests] | |
steps: | |
- name: Checkout Governance Policy Propagator | |
uses: actions/checkout@v3 | |
- name: Download Unit Coverage Result | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage_unit | |
- name: Download E2E Coverage Result | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage_e2e | |
- name: Download Compliance Events Coverage Result | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage_e2e_compliance_events_api | |
- name: Download PolicyAutomation Coverage Result | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage_e2e_policyautomation | |
- name: Test Coverage Verification | |
run: | | |
make coverage-verify | |
- name: Prepare additional artifacts for the sonarcloud workflow | |
run: | | |
make gosec-scan | |
cat gosec.json | |
cat <<EOF > event.json | |
${{ toJSON(github.event) }} | |
EOF | |
- name: Upload artifacts for the sonarcloud workflow | |
if: github.repository_owner == 'stolostron' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: | | |
./coverage*.out | |
./event.json | |
./gosec.json |