2021-05-27 15:50:10 +03:00
|
|
|
name: build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-05-29 13:05:28 +03:00
|
|
|
- main
|
2021-05-27 15:50:10 +03:00
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
2021-05-28 16:35:34 +03:00
|
|
|
fail-fast: false
|
2021-05-27 15:50:10 +03:00
|
|
|
matrix:
|
2023-09-10 01:22:02 +03:00
|
|
|
go: ["1.19", "1.20", "1.21"]
|
2021-05-27 15:50:10 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-10 01:22:02 +03:00
|
|
|
uses: actions/checkout@v4
|
2021-05-27 15:50:10 +03:00
|
|
|
- name: Setup Go
|
2023-03-31 14:29:59 +03:00
|
|
|
uses: actions/setup-go@v4
|
2021-05-27 15:50:10 +03:00
|
|
|
with:
|
2021-05-28 16:35:34 +03:00
|
|
|
go-version: "${{ matrix.go }}"
|
2022-11-29 18:00:41 +03:00
|
|
|
check-latest: true
|
2022-05-28 17:03:15 +03:00
|
|
|
- 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
|
2021-05-27 15:50:10 +03:00
|
|
|
- name: Build
|
|
|
|
run: |
|
2023-04-10 11:23:00 +03:00
|
|
|
go install github.com/mfridman/tparse@latest
|
2021-05-27 15:50:10 +03:00
|
|
|
go vet ./...
|
2023-09-10 01:22:02 +03:00
|
|
|
go test -v -race -count=1 -json -cover ./... | tee output.json | tparse -follow -notests || true
|
2023-02-19 16:01:18 +03:00
|
|
|
tparse -format markdown -file output.json -all > $GITHUB_STEP_SUMMARY
|
2021-05-27 15:50:10 +03:00
|
|
|
go build ./...
|
2023-04-10 11:23:00 +03:00
|
|
|
coverage:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-11 13:07:39 +03:00
|
|
|
uses: actions/checkout@v4
|
2023-04-10 11:23:00 +03:00
|
|
|
- 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
|