-
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.
chore: Bump Go version and add Makefile
- Loading branch information
Showing
4 changed files
with
67 additions
and
24 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 |
---|---|---|
@@ -1,40 +1,46 @@ | ||
name: Go | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
building: | ||
name: Build and cache dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v1 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
|
||
go-version: 1.22 | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- name: Get dependencies | ||
run: go get -v -t -d ./... | ||
|
||
- name: Build | ||
run: go build -v . | ||
|
||
# Running tests with and without the race checker, as certain tests are | ||
# only run when the race checker is not enabled | ||
- name: Test | ||
run: go test -v -coverprofile=profile.cov ./... | ||
|
||
- name: Coverage | ||
testing: | ||
name: Run tests | ||
needs: [building] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Run tests and generate coverage | ||
run: make coverage | ||
- name: Report coverage | ||
uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: profile.cov | ||
|
||
testing-race: | ||
name: Run tests with race checker | ||
needs: [building] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Test (race) | ||
run: go test -race -v ./... | ||
|
||
- name: Install Linter | ||
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.53.2 | ||
|
||
- name: Lint | ||
run: ./bin/golangci-lint run . | ||
linting: | ||
name: | ||
runs-on: ubuntu-latest | ||
needs: [building] | ||
steps: | ||
- name: Run linter | ||
run: make lint |
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 |
---|---|---|
|
@@ -12,3 +12,7 @@ | |
*.out | ||
|
||
tags | ||
|
||
bin/ | ||
|
||
profile.cov |
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,33 @@ | ||
LINTER_VERSION := v1.59.1 | ||
|
||
.PHONY: all | ||
all: clean bin/bugsnag lint test-race | ||
|
||
.PHONY: test | ||
test: | ||
go test -count=1 -coverprofile=profile.cov ./... | ||
|
||
.PHONY: test-race | ||
test-race: | ||
go test -count=1 -race ./... | ||
|
||
.PHONY: clean | ||
clean: | ||
-rm -r ./bin | ||
|
||
.PHONY: lint | ||
lint: bin/linter | ||
./bin/linter run ./... | ||
|
||
.PHONY: dependencies | ||
dependencies: go.mod go.sum | ||
go get -v -t -d ./... | ||
|
||
# Note: These next targets should not be PHONY | ||
|
||
bin/bugsnag: | ||
go build -o bin/bugsnag ./cmd/bugsnag | ||
|
||
bin/linter: Makefile .golangci.yml | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin $(LINTER_VERSION) | ||
mv ./bin/golangci-lint ./bin/linter |
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,5 +1,5 @@ | ||
module github.com/kinbiko/bugsnag | ||
|
||
go 1.21 | ||
go 1.22 | ||
|
||
require github.com/kinbiko/jsonassert v1.1.1 |