-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (50 loc) · 1.32 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: build-and-test
on:
push:
branches:
- main
pull_request:
branches:
- main
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
name: Go ${{ matrix.go }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
go: ["1.20"]
env:
VERBOSE: 1
GOFLAGS: -mod=readonly
GOPROXY: https://proxy.golang.org
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5.0.1
with:
go-version: ${{ matrix.go }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4.1.4
- name: Cache modules
uses: actions/cache@v4.0.2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Build
run: go build
- name: Copy .env.example to .env
run: cp .env.example .env
- name: Validate content
run: go run . content:validate --debug
- name: Test
run: go test -v ./...