-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Eray Ates <[email protected]>
- Loading branch information
Showing
20 changed files
with
353 additions
and
533 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,46 @@ | ||
name: Test | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
|
||
name: Test | ||
jobs: | ||
test: | ||
sonarcloud: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ secrets.GO_VERSION }} | ||
|
||
- name: Run coverage | ||
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./... | ||
- name: Upload coverage to Codecov | ||
run: bash <(curl -s https://codecov.io/bash) | ||
- name: get epository name | ||
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | ||
- uses: actions/checkout@v3 | ||
with: | ||
# Disabling shallow clone is recommended for improving relevancy of reporting | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.23' # The Go version to download (if necessary) and use. | ||
- name: download golangci.yml | ||
run: | | ||
[[ ! -f ".golangci.yml" ]] && curl -kfsSL -O https://raw.githubusercontent.com/worldline-go/guide/main/lint/.golangci.yml || true | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
args: --timeout 5m --new-from-rev=HEAD~1 --issues-exit-code=0 | ||
- name: Run tests | ||
run: | | ||
GOPATH="$(dirname ${PWD})" golangci-lint run --out-format checkstyle ./... > golangci-lint-report.out || true | ||
go test -coverprofile=coverage.out -json ./... > test-report.out | ||
- name: SonarCloud Scan | ||
uses: sonarsource/sonarcloud-github-action@master | ||
with: | ||
args: > | ||
-Dsonar.organization=${{ github.repository_owner }} | ||
-Dsonar.projectKey=${{ github.repository_owner }}_${{ env.REPOSITORY_NAME }} | ||
-Dsonar.go.coverage.reportPaths=coverage.out | ||
-Dsonar.go.tests.reportPaths=test-report.out | ||
-Dsonar.go.golangci-lint.reportPaths=golangci-lint-report.out | ||
-Dsonar.sources=. | ||
-Dsonar.exclusions=**/vendor/**,**/*_test.go | ||
-Dsonar.tests=. | ||
-Dsonar.test.inclusions=**/*_test.go | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
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.