-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (76 loc) · 2.61 KB
/
Copy pathgo-test.yml
File metadata and controls
90 lines (76 loc) · 2.61 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
name: Go Test
# Two-stage test pipeline mirroring the local `make test` / `make itest`
# split: fast unit tests run first (the shared unified workflow), and the
# Docker-backed integration suite (itest/) only runs once they pass — a
# broken unit test fails the PR in ~2 minutes instead of tying up a runner
# booting the Forge stack.
on:
pull_request:
push:
branches: ['main']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
unit:
uses: ipdxco/unified-github-workflows/.github/workflows/go-test.yml@1822b44541e3ad073b8f9109e346ba0ddd4ce96e # v1.0
with:
go-versions: '["this"]'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
itest:
needs: unit
# Pin to 24.04 rather than -latest so the Docker version doesn't drift
# from under us. The runner's preinstalled Docker is 28.x, well past
# smelt's 25+ requirement.
runs-on: ubuntu-24.04
timeout-minutes: 25
steps:
- name: Check out the repository
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Docker info
run: |
docker version
docker compose version
- name: Run integration tests
# GOWORK=off matches the Makefile convention (a parent go.work may
# declare a newer Go than the toolchain). The harness builds the
# working-tree binary itself (itest/stack_test.go).
env:
GOWORK: off
run: go test -tags itest -v -timeout 20m ./itest
- name: Dump container state on failure
if: failure()
run: |
mkdir -p /tmp/container-logs
{
echo "=== docker ps -a ==="
docker ps -a
echo
echo "=== docker network ls ==="
docker network ls
echo
echo "=== docker volume ls ==="
docker volume ls
} | tee /tmp/container-logs/_overview.txt
for c in $(docker ps -a --format '{{.Names}}'); do
docker logs "$c" > "/tmp/container-logs/$c.log" 2>&1 || true
echo "::group::$c"
tail -200 "/tmp/container-logs/$c.log"
echo "::endgroup::"
done
- name: Upload container logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: container-logs
path: /tmp/container-logs/
if-no-files-found: ignore
retention-days: 7