Repository navigation
108 lines (102 loc) · 3.93 KB
/
Copy pathtest.yml
File metadata and controls
108 lines (102 loc) · 3.93 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
97
98
99
100
101
102
103
104
105
106
107
108
name: Test
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# gavel does its Go work itself, and gofmt needs only the toolchain.
- uses: ./.github/actions/setup-go
with:
restore: false
- name: Lint with Gavel
uses: flanksource/gavel@43a9189b99e71ed928f418e01cd34aa797c2c0e0 # v0.0.54
with:
args: lint golangci-lint
version: v0.0.54
artifact-name: gavel-lint-results
comment-header: captain-gavel-lint
comment: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
fail-on-error: "true"
- run: test -z "$(gofmt -l .)"
test:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup-go
id: setup-go
- name: Cache embedded PostgreSQL
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/commons-db/bin
key: embedded-postgres-${{ runner.os }}-${{ runner.arch }}
# The gitagent e2e suite drives the compiled binary. Building it here
# rather than inside a test keeps the build out of that test's deadline:
# a dependency bump empties the build cache, and the build then takes
# minutes, timing out the package for reasons unrelated to the code.
- name: Build captain for the e2e suite
run: |
go build -o "${{ runner.temp }}/captain" ./cmd/captain
echo "CAPTAIN_TEST_BINARY=${{ runner.temp }}/captain" >> "$GITHUB_ENV"
# dbtest shares one embedded PostgreSQL server while isolating each test
# with a leased ephemeral database.
# pkg/cli/webapp is ignored: its vitest suite needs a sibling clicky-ui
# checkout (a link: dependency), which does not exist on CI runners.
- name: Test with Gavel
uses: flanksource/gavel@43a9189b99e71ed928f418e01cd34aa797c2c0e0 # v0.0.54
with:
# --test-timeout is the per-package deadline (gavel defaults to 5m).
# pkg/ai/fixture drives real agent subprocesses and exceeded it on a
# loaded runner, and a killed suite writes no ginkgo report, so one
# slow package was reported as three failures.
args: test --timeout 45m --test-timeout 20m --ignore tests/e2e --ignore pkg/cli/webapp
version: v0.0.54
artifact-name: gavel-test-results
comment-header: captain-gavel-test
comment: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
fail-on-error: "true"
env:
TMPDIR: ${{ runner.temp }}
# Save on main only: branch caches are not visible to other branches, and
# the key carries the commit so each main push refreshes the build cache.
- name: Save Go cache
if: ${{ !cancelled() && steps.setup-go.outputs.cache-key != '' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: actions/cache/save@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ steps.setup-go.outputs.cache-key }}
mcp-e2e:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go
- run: go test -tags=e2e -count=1 -v -timeout=8m ./tests/e2e/mcp2cli
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go
- run: go build -o captain ./cmd/captain
- uses: actions/upload-artifact@v4
with:
name: captain
path: captain