Skip to content

Commit 781e314

Browse files
committed
Add CI and output tests
1 parent d71a2ab commit 781e314

13 files changed

Lines changed: 851 additions & 816 deletions

File tree

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
format:
11+
name: CI / Format
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
20+
with:
21+
go-version-file: go.mod
22+
23+
- name: Check formatting
24+
run: make check-fmt
25+
26+
build:
27+
name: CI / Build
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
33+
34+
- name: Set up Go
35+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
36+
with:
37+
go-version-file: go.mod
38+
39+
- name: Build
40+
run: make build
41+
42+
test:
43+
name: CI / Test
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
49+
50+
- name: Set up Go
51+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
52+
with:
53+
go-version-file: go.mod
54+
55+
- name: Test
56+
run: make test

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.PHONY: fmt check-fmt test build
2+
3+
fmt:
4+
gofmt -w $$(find . -name '*.go' -not -path './.git/*')
5+
6+
check-fmt:
7+
@test -z "$$(gofmt -l $$(find . -name '*.go' -not -path './.git/*'))" || \
8+
(echo "Go files need formatting. Run 'make fmt'."; \
9+
gofmt -l $$(find . -name '*.go' -not -path './.git/*'); \
10+
exit 1)
11+
12+
test:
13+
go test ./...
14+
15+
build:
16+
go build ./...

0 commit comments

Comments
 (0)