| 1 |
name: build |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
pull_request: |
| 6 |
branches: |
| 7 |
- master |
| 8 |
|
| 9 |
jobs: |
| 10 |
build: |
| 11 |
strategy: |
| 12 |
matrix: |
| 13 |
go-version: [^1] |
| 14 |
os: [ubuntu-latest, macos-latest, windows-latest] |
| 15 |
runs-on: ${{ matrix.os }} |
| 16 |
env: |
| 17 |
GO111MODULE: "on" |
| 18 |
steps: |
| 19 |
- name: Checkout code |
| 20 |
uses: actions/checkout@v3 |
| 21 |
- name: Install Go |
| 22 |
uses: actions/setup-go@v3 |
| 23 |
with: |
| 24 |
go-version: ${{ matrix.go-version }} |
| 25 |
- uses: actions/cache@v3 |
| 26 |
with: |
| 27 |
path: ~/go/pkg/mod |
| 28 |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 29 |
restore-keys: | |
| 30 |
${{ runner.os }}-go- |
| 31 |
- name: Download Go modules |
| 32 |
run: go mod download |
| 33 |
- name: Build |
| 34 |
run: go build -v ./... |
| 35 |
- name: Test |
| 36 |
run: go test ./... |