-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (70 loc) · 2.16 KB
/
ci.yml
File metadata and controls
82 lines (70 loc) · 2.16 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.26'
- name: Module verify
run: go mod verify
- name: Vet
run: go vet ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.2.0
install-mode: goinstall
- name: Test with coverage
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.out
- name: Build
run: |
go build -ldflags "-X github.com/lakshmanpatel/gitant/internal/api.Version=ci" -o gitant ./cmd/gitant/
go build -o git-remote-gitant ./cmd/git-remote-gitant/
./gitant version | grep -q gitant
- name: Goreleaser snapshot
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: release --snapshot --clean
- name: Security scan (govulncheck)
continue-on-error: true
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
docker:
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t gitant:latest .
- name: Smoke test container
run: |
docker run -d --name gitant-test -p 7777:7777 gitant:latest serve
sleep 3
curl -f http://localhost:7777/health || (docker logs gitant-test && exit 1)
docker stop gitant-test
multinode:
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.26'
- name: Block exchange unit test
run: go test ./internal/network/... -run BlockExchange -count=1 -timeout 2m
- name: Two-node P2P mesh smoke test
run: bash scripts/ci-multinode.sh