-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mike Yastrebtsov
authored and
Mike Yastrebtsov
committed
Aug 9, 2024
1 parent
cd9b708
commit 01477c4
Showing
3 changed files
with
52 additions
and
12 deletions.
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,32 @@ | ||
name: Lint | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
permissions: | ||
contents: read | ||
jobs: | ||
lint: | ||
strategy: | ||
matrix: | ||
go: [ '1.20' ] | ||
fail-fast: true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go ${{ matrix.go }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
cache: false | ||
|
||
- name: Run GolangCI-Lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.56.1 | ||
args: --timeout=5m |
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,4 +1,4 @@ | ||
name: Go CI | ||
name: Test | ||
|
||
on: | ||
push: | ||
|
@@ -8,25 +8,39 @@ on: | |
branches: | ||
- master | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test_and_lint: | ||
name: Test, Lint, and Coverage | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go: [ '1.20' ] | ||
os: [ ubuntu-latest, macos-latest, windows-latest ] | ||
fail-fast: true | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
- name: Setup Go ${{ matrix.go }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20 | ||
go-version: ${{ matrix.go }} | ||
cache: false | ||
|
||
- name: Install dependencies | ||
run: go mod download | ||
|
||
- name: Run tests with coverage | ||
run: go test ./... -v -coverprofile=coverage.out | ||
run: go test -race -cover -coverprofile="coverage.out" -covermode=atomic -v ./... | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./coverage.out | ||
|
||
- name: Calculate coverage | ||
run: go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}' | ||
|
@@ -41,9 +55,3 @@ jobs: | |
else | ||
echo "Code coverage ($COVERAGE%) meets the threshold of 75%." | ||
fi | ||
- name: Install GolangCI-Lint | ||
run: go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
||
- name: Run GolangCI-Lint | ||
run: golangci-lint run |
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