Adapt the operator CI install script to work on non OCP-clusters #855
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: PR Test operator | |
on: | |
pull_request: | |
branches: | |
- main | |
- rhdh-1.[0-9]+ | |
- 1.[0-9]+.x | |
- release-1.[0-9]+ | |
jobs: | |
pr-validate: | |
name: PR Validate | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-depth: 0 | |
# check changes in this commit for regex include and exclude matches; pipe to an env var | |
- name: Check for changes to build | |
run: | | |
# don't fail if nothing returned by grep | |
set +e | |
CHANGES="$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | \ | |
grep -E "workflows/pr.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go" | \ | |
grep -v -E "/.rhdh/")"; | |
echo "Changed files for this commit:" | |
echo "==============================" | |
echo "$CHANGES" | |
echo "==============================" | |
{ | |
echo 'CHANGES<<EOF' | |
echo $CHANGES | |
echo EOF | |
} >> "$GITHUB_ENV" | |
- name: Setup Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5 | |
with: | |
go-version-file: 'go.mod' | |
# gosec needs a "build" stage so connect it to the lint step which we always do | |
- name: build | |
run: make lint | |
- name: Start Minikube | |
# run this stage only if there are changes that match the includes and not the excludes | |
if: ${{ env.CHANGES != '' }} | |
uses: medyagh/setup-minikube@latest | |
- name: Run Controller | |
# run this stage only if there are changes that match the includes and not the excludes | |
if: ${{ env.CHANGES != '' }} | |
run: make install run & | |
- name: Test | |
# run this stage only if there are changes that match the includes and not the excludes | |
if: ${{ env.CHANGES != '' }} | |
run: make test | |
- name: Generic Integration test | |
# run this stage only if there are changes that match the includes and not the excludes | |
# perform it on backstage.io for speed | |
if: ${{ env.CHANGES != '' }} | |
run: make integration-test PROFILE=backstage.io USE_EXISTING_CLUSTER=true USE_EXISTING_CONTROLLER=true | |
- name: RHDH specific Integration test | |
# run this stage only if there are changes that match the includes and not the excludes | |
if: ${{ env.CHANGES != '' }} | |
run: make integration-test ARGS='--focus "create default rhdh"' USE_EXISTING_CLUSTER=true USE_EXISTING_CONTROLLER=true | |
- name: Run Gosec Security Scanner | |
run: make gosec | |
- name: Upload SARIF file | |
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3 | |
with: | |
# Path to SARIF file relative to the root of the repository | |
sarif_file: gosec.sarif |