-
Notifications
You must be signed in to change notification settings - Fork 88
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
refactor: lint and test workflows #973
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
aff445b
lint action: split away from test actions
lufia eb0ed88
check convention: split away from test-linux action
lufia 3d1d1b0
test-linux and test-windows are merged into the test job
lufia 88a3a9e
ci: fix failure on macos runners
lufia 15310ca
ci: use LF line ending always in the case of *.go files
lufia b154eea
ci: enables gofmt linter of golangci
lufia 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 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
*.go text eol=lf |
This file contains 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 |
---|---|---|
|
@@ -8,57 +8,23 @@ on: | |
- v* | ||
|
||
jobs: | ||
test-linux: | ||
name: Test (Linux) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.20.x | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v4 | ||
- uses: golangci/golangci-lint-action@v3 | ||
- run: make convention | ||
- run: make cover | ||
- run: test "$(gofmt -l . | wc -l)" = 0 | ||
- uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: .profile.cov | ||
|
||
test-windows: | ||
name: Test (Windows) | ||
# Please do not specify `windows-latest` | ||
# Build process is complex then need to check operation. | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.20.x | ||
|
||
- uses: golangci/golangci-lint-action@v3 | ||
with: | ||
args: --timeout 5m | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**\go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
|
||
- name: Run Test | ||
run: | | ||
go test -short ./... | ||
shell: bash | ||
lint: | ||
uses: mackerelio/workflows/.github/workflows/[email protected] | ||
convention: | ||
uses: mackerelio/workflows/.github/workflows/[email protected] | ||
with: | ||
run: make convention | ||
test: | ||
uses: mackerelio/workflows/.github/workflows/[email protected] | ||
with: | ||
# Please do not specify `windows-latest` | ||
# Build process is complex then need to check operation. | ||
os-versions: '["ubuntu-latest", "windows-2022"]' | ||
|
||
build-linux: | ||
name: Build (Linux) | ||
runs-on: ubuntu-latest | ||
needs: test-linux | ||
needs: test | ||
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
|
@@ -95,7 +61,7 @@ jobs: | |
build-windows: | ||
name: Build (Windows) | ||
runs-on: windows-2022 | ||
needs: test-windows | ||
needs: test | ||
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') | ||
strategy: | ||
matrix: | ||
|
This file contains 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
!.circleci | ||
!.dependabot | ||
!.github | ||
!.gitattributes | ||
!.gitignore | ||
!.goxc.json | ||
!.travis.yml | ||
|
This file contains 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,3 +1,9 @@ | ||
linters: | ||
enable: | ||
- gofmt | ||
linters-settings: | ||
gofmt: | ||
simplify: true | ||
issues: | ||
exclude-rules: | ||
- path: _test\.go | ||
|
This file contains 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 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-short
no longer reduce anything#972