Skip to content

Commit 6874970

Browse files
committed
ci.yml & Makefile
1 parent e1881bd commit 6874970

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-test-lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Set up Go
11+
uses: actions/setup-go@v4
12+
with:
13+
go-version: '1.25'
14+
- name: Cache Go modules
15+
uses: actions/cache@v4
16+
with:
17+
path: ~/.cache/go-build
18+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
19+
- name: Install golangci-lint
20+
run: |
21+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0
22+
- name: Lint
23+
run: golangci-lint run ./...
24+
- name: Test
25+
run: go test -v ./...
26+
- name: Build
27+
run: go build -v ./...
28+

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.PHONY: fmt lint test bench build docker
2+
3+
fmt:
4+
ifeq ($(shell test -e go.mod && echo yes),yes)
5+
gofmt -s -w .
6+
else
7+
prettier --write .
8+
endif
9+
10+
lint:
11+
golangci-lint run ./...
12+
13+
test:
14+
go test ./...
15+
16+
bench:
17+
go test -bench . -benchmem ./...
18+
19+
build:
20+
go build -o bin/app ./cmd/...
21+
22+
docker:
23+
docker build -t myorg/robot:latest .
24+

0 commit comments

Comments
 (0)