-
Notifications
You must be signed in to change notification settings - Fork 8
96 lines (89 loc) · 2.41 KB
/
Copy pathci.yml
File metadata and controls
96 lines (89 loc) · 2.41 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Vet
run: go vet ./...
- name: Format
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go files must be formatted with gofmt"
gofmt -d .
exit 1
fi
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Lint
run: golangci-lint run ./...
- name: Install gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Security
run: gosec ./...
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go: ["1.23"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Test
run: go test -v -race -cover ./internal/...
- name: Coverage
run: |
go test -coverprofile=coverage.out ./internal/...
go tool cover -func=coverage.out
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: E2E tests
run: go test -v ./e2e/...
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Build all binaries
run: make build-all
- name: Check binary sizes
run: |
ls -lh bin/
SIZE=$(stat -c%s bin/pastelocal-remote-linux-amd64 2>/dev/null || stat -f%z bin/pastelocal-remote-linux-amd64)
if [ "$SIZE" -gt 8388608 ]; then
echo "FAIL: pastelocal-remote is larger than 8 MiB"
exit 1
fi
- name: Verify goreleaser config
run: |
go install github.com/goreleaser/goreleaser/v2@latest
goreleaser check
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Integration tests
run: go test -v -tags=integration ./internal/...