| 1 |
name: Build |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
pull_request: |
| 8 |
branches: |
| 9 |
- main |
| 10 |
|
| 11 |
jobs: |
| 12 |
lint: |
| 13 |
runs-on: ubuntu-latest |
| 14 |
steps: |
| 15 |
- name: Checkout scm |
| 16 |
uses: actions/checkout@v3 |
| 17 |
|
| 18 |
- name: Set up Go |
| 19 |
uses: actions/setup-go@v6 |
| 20 |
with: |
| 21 |
go-version-file: go.mod |
| 22 |
|
| 23 |
|
| 24 |
- name: golangci-lint |
| 25 |
uses: golangci/golangci-lint-action@v8 |
| 26 |
with: |
| 27 |
version: v2.8 |
| 28 |
build: |
| 29 |
name: Build |
| 30 |
runs-on: ubuntu-latest |
| 31 |
steps: |
| 32 |
- name: Set up Go 1.x |
| 33 |
uses: actions/setup-go@v3 |
| 34 |
with: |
| 35 |
go-version: 1.25 |
| 36 |
id: go |
| 37 |
|
| 38 |
- name: Checkout code |
| 39 |
uses: actions/checkout@v3 |
| 40 |
|
| 41 |
- name: Get dependencies |
| 42 |
run: | |
| 43 |
go get -v -t -d ./... |
| 44 |
if [ -f Gopkg.toml ]; then |
| 45 |
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh |
| 46 |
dep ensure |
| 47 |
fi |
| 48 |
- name: Test |
| 49 |
run: go test ./... |
| 50 |
- name: Coverage |
| 51 |
run: | |
| 52 |
go get github.com/axw/gocov/gocov |
| 53 |
go get github.com/AlekSi/gocov-xml |
| 54 |
go install github.com/axw/gocov/gocov |
| 55 |
go install github.com/AlekSi/gocov-xml |
| 56 |
- run: | |
| 57 |
go test -v -coverprofile cover.out ./... |
| 58 |
gocov convert cover.out | gocov-xml > coverage.xml |
| 59 |
- uses: codecov/codecov-action@v4 |
| 60 |
with: |
| 61 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 62 |
files: ./coverage.xml |
| 63 |
flags: unittests |
| 64 |
fail_ci_if_error: false |
| 65 |
verbose: true |