-
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.
feat(ci): create a CI workflow to build and test code
- Loading branch information
Showing
5 changed files
with
117 additions
and
39 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,74 @@ | ||
name: Test | ||
|
||
on: [push] | ||
|
||
env: | ||
SIL_COMMS_BASE_URL: ${{ secrets.SIL_COMMS_BASE_URL }} | ||
SIL_COMMS_EMAIL: ${{ secrets.SIL_COMMS_EMAIL }} | ||
SIL_COMMS_PASSWORD: ${{ secrets.SIL_COMMS_PASSWORD }} | ||
SIL_COMMS_SENDER_ID: ${{ secrets.SIL_COMMS_SENDER_ID }} | ||
|
||
jobs: | ||
lint_and_test: | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
go-version: [1.17.x] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Golang | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.29 | ||
|
||
- name: Install Go dependencies | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.37.1 | ||
go get -u github.com/kisielk/errcheck | ||
go get -u golang.org/x/lint/golint | ||
go get -u honnef.co/go/tools/cmd/staticcheck | ||
go get -u github.com/axw/gocov/gocov | ||
go get -u github.com/securego/gosec/cmd/gosec | ||
go get -u github.com/ory/go-acc | ||
go get -u github.com/client9/misspell/cmd/misspell | ||
go get -u github.com/gordonklaus/ineffassign | ||
go get github.com/fzipp/gocyclo | ||
go get github.com/stretchr/testify/assert@v1.7.0 | ||
go get github.com/ory/go-acc | ||
go get google.golang.org/grpc@v1.38.0 | ||
go get google.golang.org/grpc/balancer/grpclb@v1.38.0 | ||
go get google.golang.org/api/support/bundler@v0.48.0 | ||
- name: Run lint and test | ||
run: | | ||
staticcheck ./... | ||
go fmt $(go list ./... | grep -v /vendor/) | ||
go vet $(go list ./... | grep -v /vendor/) | ||
golint -set_exit_status $(go list ./... | grep -v /vendor/) | ||
errcheck -ignore 'os:.*,' $(go list ./... | grep -v /vendor/) | ||
misspell -error . | ||
gosec ./... | ||
go-acc -o coverage.txt --ignore generated,cmd ./... -- -timeout 60m | ||
grep -v "generated.go" coverage.txt > coverage.out | ||
go tool cover -html=coverage.out -o coverage.html | ||
gocov convert coverage.out > coverage.json | ||
gocov report coverage.json > coverage_report.txt | ||
tail coverage_report.txt | ||
- name: Install goveralls | ||
env: | ||
GO111MODULE: off | ||
run: go get github.com/mattn/goveralls | ||
|
||
- name: Send coverage | ||
env: | ||
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: goveralls -coverprofile=coverage.out -service=github |
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
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