Skip to content

Commit

Permalink
fix: save CI time and run checks conditionally
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Matyushentsev <[email protected]>
  • Loading branch information
alexmt committed May 10, 2023
1 parent 4484ce8 commit 1edea4a
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,27 @@ permissions:
contents: read

jobs:
changes:
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
backend:
- '!(ui/**)'
- '!(**/*.md)'
frontend:
- 'ui/**'
check-go:
name: Ensure Go modules synchronicity
runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.backend == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
Expand All @@ -44,6 +62,7 @@ jobs:
build-go:
name: Build & cache Go code
runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.backend == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
Expand All @@ -68,6 +87,7 @@ jobs:
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: Lint Go code
runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.backend == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
Expand All @@ -84,6 +104,7 @@ jobs:
test-go:
name: Run unit tests for Go packages
runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.backend == 'true' }}
needs:
- build-go
env:
Expand Down Expand Up @@ -151,6 +172,7 @@ jobs:
test-go-race:
name: Run unit tests with -race, for Go packages
runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.backend == 'true' }}
needs:
- build-go
env:
Expand Down Expand Up @@ -213,6 +235,7 @@ jobs:
codegen:
name: Check changes to generated code
runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.backend == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
Expand Down Expand Up @@ -261,6 +284,7 @@ jobs:
build-ui:
name: Build, test & lint UI code
runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.frontend == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
Expand Down Expand Up @@ -293,6 +317,7 @@ jobs:
analyze:
name: Process & analyze test artifacts
runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true' }}
needs:
- test-go
- build-ui
Expand Down Expand Up @@ -359,11 +384,10 @@ jobs:
test-e2e:
name: Run end-to-end tests
runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.backend == 'true' }}
strategy:
matrix:
k3s-version: [v1.26.0, v1.25.4, v1.24.3, v1.23.3]
needs:
- build-go
env:
GOPATH: /home/runner/go
ARGOCD_FAKE_IN_CLUSTER: "true"
Expand Down

0 comments on commit 1edea4a

Please sign in to comment.