forked from 5GSEC/nimbus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(CI): Run CI based on conditional changes
Signed-off-by: Anurag Rajawat <[email protected]>
- Loading branch information
Anurag Rajawat
committed
May 22, 2024
1 parent
b6dd9b6
commit 189d5d2
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -4,6 +4,10 @@ | |
name: PR checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- fix-ci | ||
- main | ||
pull_request: | ||
types: [ opened, reopened, synchronize, ready_for_review ] | ||
paths-ignore: | ||
|
@@ -29,6 +33,9 @@ jobs: | |
static-checks: | ||
name: Static checks | ||
runs-on: ubuntu-latest | ||
outputs: | ||
nimbus: ${{ steps.filter.outputs.nimbus}} | ||
adapters: ${{ steps.filter.outputs.adapters }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
|
@@ -37,10 +44,29 @@ jobs: | |
with: | ||
go-version: '1.22' | ||
|
||
# Checks to see if any files in the PR match one of the listed file types. | ||
# We can use this filter to decide whether to run linters, tests or build container image. | ||
# You can check if a file with a listed file type is in the PR by doing: | ||
# if: ${{ steps.filter.outputs.nimbus == 'true' }} | ||
- name: Detect what files changed | ||
uses: dorny/[email protected] | ||
id: filter | ||
with: | ||
filters: | | ||
nimbus: | ||
- 'api/**' | ||
- 'cmd/**' | ||
- 'internal/**' | ||
- 'pkg/processor/**' | ||
adapters: | ||
- 'pkg/adapter/**' | ||
- name: go fmt | ||
if: ${{ steps.filter.outputs.nimbus == 'true' || steps.filter.outputs.adapters == 'true' }} | ||
run: make fmt | ||
|
||
- name: Lint | ||
if: ${{ steps.filter.outputs.nimbus == 'true' || steps.filter.outputs.adapters == 'true' }} | ||
id: lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
|
@@ -49,6 +75,7 @@ jobs: | |
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778 | ||
|
||
go-sec: | ||
if: ${{ steps.filter.outputs.nimbus == 'true' || steps.filter.outputs.adapters == 'true' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
security-events: write | ||
|
@@ -70,6 +97,7 @@ jobs: | |
sarif_file: results.sarif | ||
|
||
build-nimbus-image: | ||
if: ${{ steps.filter.outputs.nimbus == 'true' }} | ||
name: Build Nimbus Operator image | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
|
@@ -81,6 +109,7 @@ jobs: | |
run: make docker-build | ||
|
||
build-adapters-image: | ||
if: ${{ steps.filter.outputs.adapters == 'true' }} | ||
strategy: | ||
matrix: | ||
adapters: [ "nimbus-kubearmor", "nimbus-netpol", "nimbus-kyverno" ] | ||
|
@@ -96,6 +125,7 @@ jobs: | |
run: make docker-build | ||
|
||
chainsaw-integration-tests: | ||
if: ${{ steps.filter.outputs.nimbus == 'true' }} | ||
name: Integration-Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -131,6 +161,7 @@ jobs: | |
run: make integration-test | ||
|
||
chainsaw-e2e-tests: | ||
if: ${{ steps.filter.outputs.nimbus == 'true' || steps.filter.outputs.adapters == 'true' }} | ||
name: E2E-Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|