mirror of https://github.com/golang-jwt/jwt.git
55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
go: ["1.18.x", "1.19.x", "1.20.x"]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: "${{ matrix.go }}"
|
|
check-latest: true
|
|
cache: true
|
|
- name: Check Go code formatting
|
|
run: |
|
|
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
|
|
gofmt -s -l .
|
|
echo "Please format Go code by running: go fmt ./..."
|
|
exit 1
|
|
fi
|
|
- name: Build
|
|
run: |
|
|
go install github.com/mfridman/tparse@latest
|
|
go vet ./...
|
|
go test -v -race -count=1 -json -coverpkg=$(go list ./...) ./... | tee output.json | tparse -follow -notests || true
|
|
tparse -format markdown -file output.json -all > $GITHUB_STEP_SUMMARY
|
|
go build ./...
|
|
coverage:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v4
|
|
- name: Coverage
|
|
run: |
|
|
go test -v -covermode=count -coverprofile=coverage.cov ./...
|
|
- name: Coveralls
|
|
uses: coverallsapp/github-action@v2
|
|
with:
|
|
file: coverage.cov
|
|
format: golang
|