-
Notifications
You must be signed in to change notification settings - Fork 254
Modernize codebase: Fix linting issues, update CI/CD workflow, and improve test categorization #549
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
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b5a14ae
Fix linter failures
YakDriver 68dfa06
Lint in modern Go
YakDriver fdafd00
Update github workflows
YakDriver 7ede6ad
Fix linting
YakDriver 7eaf101
Remove io/ioutil
YakDriver 0e9474c
Modern Go code
YakDriver 0176088
Only main
YakDriver 7bbda64
Verbose unit tests
YakDriver 26cca7c
Split tests into integration and unit with short flag
YakDriver d26a61d
Don't use integration flag
YakDriver 5ca8e3a
Use t.TempDir instead of custom temp dirs
YakDriver eecb0a0
Remove more manual temp dirs
YakDriver b8a3d71
Fix Hg tests
YakDriver 7f63e1d
Remove mercurial stuff
YakDriver 176ea32
Cleanup hg/mercurial messy test
YakDriver 86bcca8
Upgrade to Go 1.24, remove 1.23 validation
YakDriver cceea8d
Remove ancient go mod download
YakDriver f07d68b
Fix caching
YakDriver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
name: go-getter | ||
|
||
on: [push] | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
TEST_RESULTS_PATH: /tmp/test-results | ||
|
||
jobs: | ||
|
||
linux-tests: | ||
# Basic validation that runs on both PRs and pushes (safe operations) | ||
basic-validation: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: | ||
- 1.18 | ||
- 1.19 | ||
permissions: | ||
id-token: write | ||
contents: read | ||
- "1.24" | ||
- "1.25" | ||
steps: | ||
- name: Setup go | ||
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | ||
|
@@ -26,23 +28,17 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.0.0 | ||
|
||
- name: Create test directory | ||
run: | | ||
mkdir -p ${{ env.TEST_RESULTS_PATH }} | ||
|
||
- name: Setup cache for go modules | ||
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
key: ${{ runner.os }}-go${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go${{ matrix.go-version }}- | ||
${{ runner.os }}-go- | ||
|
||
- name: Download go modules | ||
run: go mod download | ||
|
||
# Check go fmt output because it does not report non-zero when there are fmt changes | ||
- name: Run gofmt | ||
run: | | ||
|
@@ -54,6 +50,74 @@ jobs: | |
exit 1 | ||
fi | ||
|
||
- name: Build all packages | ||
run: go build ./... | ||
|
||
- name: Run unit tests (without cloud integration) | ||
run: go test -short -v ./... | ||
|
||
# Linter runs on both PRs and pushes (safe operation) | ||
linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.0.0 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | ||
with: | ||
go-version: "1.25" # Use latest for linting | ||
|
||
- name: Setup cache for go modules | ||
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
~/.cache/golangci-lint | ||
key: ${{ runner.os }}-lint-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-lint- | ||
|
||
- name: Lint code | ||
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 | ||
|
||
# Full integration tests with cloud resources (only on push to protected branches) | ||
linux-integration-tests: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
strategy: | ||
matrix: | ||
go-version: | ||
- "1.24" | ||
- "1.25" | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- name: Setup go | ||
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.0.0 | ||
|
||
- name: Create test directory | ||
run: | | ||
mkdir -p ${{ env.TEST_RESULTS_PATH }} | ||
|
||
- name: Setup cache for go modules | ||
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go${{ matrix.go-version }}- | ||
${{ runner.os }}-go- | ||
|
||
- name: Install gotestsum | ||
run: go install gotest.tools/[email protected] | ||
|
||
|
@@ -86,13 +150,14 @@ jobs: | |
name: linux-test-results-${{ matrix.go-version }} | ||
path: linux_cov.part | ||
|
||
windows-tests: | ||
windows-integration-tests: | ||
runs-on: windows-latest | ||
if: github.event_name == 'push' | ||
strategy: | ||
matrix: | ||
go-version: | ||
- 1.18 | ||
- 1.19 | ||
- "1.24" | ||
- "1.25" | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
@@ -114,13 +179,11 @@ jobs: | |
path: | | ||
~\AppData\Local\go-build | ||
~\go\pkg\mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
key: ${{ runner.os }}-go${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go${{ matrix.go-version }}- | ||
${{ runner.os }}-go- | ||
|
||
- name: Download go modules | ||
run: go mod download | ||
|
||
- name: Install gotestsum | ||
shell: bash | ||
run: go install gotest.tools/[email protected] | ||
|
@@ -154,11 +217,3 @@ jobs: | |
with: | ||
name: windows-test-results-${{ matrix.go-version }} | ||
path: win_cov.part | ||
|
||
linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.0.0 | ||
- name: Lint code | ||
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.