Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: save CI time and run checks conditionally #13507

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion ui/src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as ReactDOM from 'react-dom';
import * as Moment from 'moment';
import {App} from './app';

ReactDOM.render(<App />, document.getElementById('app'));
ReactDOM.render(<><App /></>, document.getElementById('app'));

const mdl = module as any;
if (mdl.hot) {
Expand Down