Skip to content

Commit

Permalink
Move all linting to checks.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Aug 13, 2024
1 parent e8e93b7 commit c59e366
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
with:
check-latest: true
go-version: 1.22.6
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
- name: Dependency Licenses Review
run: make check-dependency-licenses
- name: Run govulncheck
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ name: CI
permissions:
contents: read
jobs:
buildAndLint:
name: Build & Lint
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand All @@ -31,14 +31,10 @@ jobs:
go-version: 1.22.6
- name: Build all binaries
run: make build-all
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
test:
name: Test
needs:
- buildAndLint
- build
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand Down
8 changes: 8 additions & 0 deletions internal/ghworkflow/workflow_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ func checksWorkflow(cfg core.Configuration) {
w := newWorkflow("Checks", ghwCfg.Global.DefaultBranch, nil)
j := baseJobWithGo("Checks", cfg)

j.addStep(jobStep{
Name: "Run golangci-lint",
Uses: core.GolangciLintAction,
With: map[string]any{
"version": "latest",
},
})

if ghwCfg.SecurityChecks.Enabled == nil || *ghwCfg.SecurityChecks.Enabled {
j.addStep(jobStep{
Name: "Dependency Licenses Review",
Expand Down
16 changes: 4 additions & 12 deletions internal/ghworkflow/workflow_ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,18 @@ func ciWorkflow(cfg core.Configuration) {
}

w.Jobs = make(map[string]job)
buildAndLintJob := baseJobWithGo("Build & Lint", cfg)
build := baseJobWithGo("Build", cfg)
if len(cfg.Binaries) > 0 {
buildAndLintJob.addStep(jobStep{
build.addStep(jobStep{
Name: "Build all binaries",
Run: "make build-all",
})
}

buildAndLintJob.addStep(jobStep{
Name: "Run golangci-lint",
Uses: core.GolangciLintAction,
With: map[string]any{
"version": "latest",
},
})

w.Jobs["buildAndLint"] = buildAndLintJob
w.Jobs["build"] = build

testJob := buildOrTestBaseJob("Test", cfg)
testJob.Needs = []string{"buildAndLint"}
testJob.Needs = []string{"build"}
if ghwCfg.CI.Postgres {
testJob.Services = map[string]jobService{"postgres": {
Image: "postgres:" + core.DefaultPostgresVersion,
Expand Down

0 comments on commit c59e366

Please sign in to comment.