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

Add golangci-lint job in CI #36

Merged
merged 3 commits into from
May 2, 2024
Merged
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
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,35 @@ on:
permissions:
contents: read
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: hack/ccp/go.mod
cache-dependency-path: hack/ccp/go.sum
- name: Get date
id: get-date
shell: bash
run: |
echo "::set-output name=date::$(date -u "+%Y-%m")"
- name: Restore golangci-lint cache
uses: actions/cache@v4
timeout-minutes: 10
continue-on-error: true
with:
path: ${{ runner.temp }}/golangci-lint-cache
key: ${{ runner.os }}-golangci-lint-cache-${{ steps.get-date.outputs.date }}
restore-keys: |
${{ runner.os }}-golangci-lint-cache-
- name: Run golangci-lint
run: make lint
env:
GOLANGCI_LINT_CACHE: ${{ runner.temp }}/golangci-lint-cache
working-directory: hack/ccp
test:
name: Test
strategy:
Expand Down
4 changes: 4 additions & 0 deletions hack/ccp/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ linters:
- gci
- unparam
- gosec
disable:
# There is too much WIP code at the moment.
# TODO: enable this ASAP.
- unused

issues:
exclude-dirs:
Expand Down
8 changes: 4 additions & 4 deletions hack/ccp/internal/controller/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (l *outputDecisionJob) exec(ctx context.Context) (uuid.UUID, error) {

panic("not implemented")

return uuid.Nil, nil
return uuid.Nil, nil // nolint: govet
}

// nextChainDecisionJob.
Expand Down Expand Up @@ -488,7 +488,7 @@ func (l *updateContextDecisionJob) await(ctx context.Context, opts []option) (_
return uuid.Nil, err
}

decision, err := l.j.pkg.AwaitDecision(ctx, opts)
decision, err := l.j.pkg.AwaitDecision(ctx, opts) // nolint: staticcheck
if err != nil {
return uuid.Nil, err
}
Expand All @@ -498,7 +498,7 @@ func (l *updateContextDecisionJob) await(ctx context.Context, opts []option) (_

panic("not implemented")

return decision.uuid(), nil
return decision.uuid(), nil // nolint: govet
}

// directoryClientScriptJob.
Expand Down Expand Up @@ -736,7 +736,7 @@ func (l *outputClientScriptJob) exec(ctx context.Context) (uuid.UUID, error) {

panic("not implemented")

return uuid.Nil, nil
return uuid.Nil, nil // nolint: govet
}

// setUnitVarLinkJob is a local job that sets the unit variable configured in
Expand Down
4 changes: 1 addition & 3 deletions hack/ccp/internal/controller/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func newTaskBackend(logger logr.Logger, job *job, config *workflow.LinkStandardT
}
}

func (b *taskBackend) submit(pCtx *packageContext, args string, wantsOutput bool, stdoutFilePath, stderrFilePath string) uuid.UUID {
func (b *taskBackend) submit(pCtx *packageContext, args string, wantsOutput bool, stdoutFilePath, stderrFilePath string) {
t := &task{
ID: uuid.New(),
CreatedAt: time.Now().UTC(),
Expand All @@ -47,8 +47,6 @@ func (b *taskBackend) submit(pCtx *packageContext, args string, wantsOutput bool
}

b.tasks.Tasks[t.ID] = t

return t.ID
}

func (b *taskBackend) wait(ctx context.Context) (*taskResults, error) {
Expand Down
Loading