-
Notifications
You must be signed in to change notification settings - Fork 27
43 lines (35 loc) · 943 Bytes
/
test.yml
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
# The "display name", shown in the GitHub UI
name: Test and lint
on:
pull_request
jobs:
test: # The 'build' job
name: "Build application"
runs-on: 'ubuntu-latest'
steps:
# Checkout code
- uses: actions/checkout@v4
# Install go 1.21
- name: Setup go
uses: actions/setup-go@v4
with: # Specify input variables to the action
go-version: '1.21.x'
# Shell script to print the version
- run: go version
- name: Build
run: go build -v ./...
- name: Test
run: go test ./...
lint:
name: Lint
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '1.21.x'
- name: Verify formatting
run: |
no_unformatted_files="$(gofmt -l $(git ls-files '*.go') | wc -l)"
exit "$no_unformatted_files"