-
Notifications
You must be signed in to change notification settings - Fork 425
43 lines (36 loc) · 1.1 KB
/
build-and-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Build and Test
# Trigger the action on push and pull requests
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.14']
steps:
- uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version
run: go version
- name: Install dependencies
run: go mod download
# Add CGO_CFLAGS environment variable to suppress the warning
- name: Build
run: go build -v ./...
env:
CGO_CFLAGS: "-Wno-return-local-addr"
# Run tests with CGO_CFLAGS set
- name: Test with the Go CLI
run: go test $(go list ./...) -cover -json > TestResults-${{ matrix.go-version }}.json
env:
CGO_CFLAGS: "-Wno-return-local-addr"
- name: Upload Go test results
uses: actions/upload-artifact@v4
with:
name: Go-results-${{ matrix.go-version }}
path: TestResults-${{ matrix.go-version }}.json