-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (113 loc) · 3.84 KB
/
Copy pathtests.yaml
File metadata and controls
135 lines (113 loc) · 3.84 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
name: tests
on:
push:
permissions:
contents: read
packages: read
jobs:
build-test:
name: Build and test
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Check Go formatting
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "The following files are not formatted:"
echo "$unformatted"
echo ""
echo "Please run 'make fmt' to format the code"
exit 1
fi
- name: Run GolangCI linter
uses: golangci/golangci-lint-action@v9
with:
version: v2.11.4
- name: Start Workbench
id: start-workbench
uses: scality/workbench@v0.16.0
- name: Wait for ClickHouse setup and fix permissions
run: |
# Wait for workbench setup container to complete
timeout 60 bash -c 'until [ "$(docker inspect -f {{.State.Status}} workbench-setup-clickhouse 2>/dev/null)" = "exited" ]; do sleep 1; done'
# Wait for ClickHouse shards to be ready (workbench uses port 9002 internally)
for i in {1..30}; do
if docker exec workbench-clickhouse-shard-1 clickhouse-client --host localhost --port 9002 --query "SELECT 1" >/dev/null 2>&1; then
break
fi
sleep 2
done
for i in {1..30}; do
if docker exec workbench-clickhouse-shard-2 clickhouse-client --host localhost --port 9002 --query "SELECT 1" >/dev/null 2>&1; then
break
fi
sleep 2
done
- name: Wait for S3 endpoint
run: |
set -e
echo "Waiting for workbench-s3 container to be running..."
if ! timeout 90 bash -c 'until [ "$(docker inspect -f {{.State.Status}} workbench-s3 2>/dev/null)" = "running" ]; do sleep 1; done'; then
echo "ERROR: workbench-s3 container did not start in time"
docker logs workbench-s3 || true
exit 1
fi
echo "✓ workbench-s3 container running"
echo "Waiting for S3 endpoint to be available..."
s3_ready=false
for i in {1..60}; do
if curl -s http://localhost:8000 >/dev/null 2>&1; then
s3_ready=true
break
fi
sleep 2
done
if [ "$s3_ready" = false ]; then
echo "ERROR: S3 endpoint (localhost:8000) did not become available in time"
docker inspect workbench-s3 | jq '.[0].State' || true
docker logs workbench-s3 || true
exit 1
fi
echo "✓ S3 endpoint available"
- name: Restore Go 1.25
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Run unit tests
run: make test-coverage
- name: Generate coverage HTML report
run: make coverage-report
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v6
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: log-courier
path: ./bin/log-courier
- name: Stop Workbench
if: (success() || failure()) && steps.start-workbench.outcome != 'skipped'
run: |
workbench logs
workbench down