Skip to content

ci: improve Go caching #7954

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

Merged
merged 27 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
improve lint
  • Loading branch information
ammario committed Jun 10, 2023
commit 0b268563323a199e18ea018667b3d031642eb980
23 changes: 6 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ jobs:
echo "${{ toJSON(steps.filter )}}"

lint:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
# golangci-lint is heavily parallelizable.
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-32vcpu-ubuntu-2204' || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -102,7 +103,7 @@ jobs:

- uses: ./.github/actions/setup-node

# Check for any typos!
# Check for any typos
- name: Check for typos
uses: crate-ci/typos@v1.14.12
with:
Expand All @@ -115,28 +116,16 @@ jobs:
cargo install typos-cli
typos -c .github/workflows/typos.toml -w"

# Check for Go linting errors!
- name: install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2

- name: make lint
run: |
make --output-sync -j lint

# Make sure the Helm chart is linted!
# Needed for helm chart linting
- name: Install helm
uses: azure/setup-helm@v3
with:
version: v3.9.2

- name: Lint Helm chart
- name: make lint
run: |
cd helm
make lint

# Ensure AGPL and Enterprise are separated!
- name: Check for AGPL code importing Enterprise...
run: ./scripts/check_enterprise_imports.sh
make --output-sync -j lint

gen:
timeout-minutes: 8
Expand Down
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ issues:
max-same-issues: 0

run:
concurrency: 4
skip-dirs:
- node_modules
skip-files:
Expand Down
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,17 @@ else
endif
.PHONY: fmt/shfmt

lint: lint/shellcheck lint/go
lint: lint/shellcheck lint/go lint/ts lint/helm lint/agpl
.PHONY: lint

lint/ts:
cd site
yarn && yarn lint
.PHONY: lint/ts

lint/go:
./scripts/check_enterprise_imports.sh
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be skipped if golangci-lint is in PATH?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do it though? It runs almost instantly if already installed.

golangci-lint run
.PHONY: lint/go

Expand All @@ -416,6 +422,15 @@ lint/shellcheck: $(SHELL_SRC_FILES)
shellcheck --external-sources $(SHELL_SRC_FILES)
.PHONY: lint/shellcheck

lint/helm:
cd helm
make lint
.PHONY: lint/helm

lint/agpl:
./scripts/check_enterprise_imports.sh
.PHONY: lint/agpl

# all gen targets should be added here and to gen/mark-fresh
gen: \
coderd/database/dump.sql \
Expand Down
3 changes: 2 additions & 1 deletion enterprise/cli/root_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package cli
import (
"testing"

"github.com/coder/coder/cli"
"github.com/stretchr/testify/require"

"github.com/coder/coder/cli"

"github.com/coder/coder/cli/clibase"

"github.com/coder/coder/cli/clitest"
Expand Down