-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (70 loc) · 2.19 KB
/
Copy pathci.yaml
File metadata and controls
76 lines (70 loc) · 2.19 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
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
lint-test:
name: Lint and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Verify formatting
run: test -z "$(gofmt -l . | tee /dev/stderr)"
- name: Vet
run: go vet ./...
- name: Test
run: go test -race ./...
- name: Verify the golden route tables are current
run: |
go test ./internal/plan -args -update
git diff --exit-code internal/plan/testdata
- name: Validate the generated OpenAPI document
run: |
go run ./cmd/gqlgate openapi \
--schema.path internal/gqlschema/testdata/pdbq.json \
--upstream.url http://unused > /tmp/openapi.json
pip install --quiet openapi-spec-validator
python -c "
import json
from openapi_spec_validator import validate
validate(json.load(open('/tmp/openapi.json')))
print('OpenAPI document is valid')
"
e2e:
name: End-to-end against pdbq
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Start the pdbq stack
run: docker compose -p gqlgate-test -f compose.test.yaml up -d --wait
- name: Run the end-to-end suite
env:
GQLGATE_TEST_TARGET_URL: http://localhost:8090
GQLGATE_TEST_VERBOSE_URL: http://localhost:8091
run: go test ./test/... -count=1 -v
- name: Upstream logs on failure
if: failure()
run: docker compose -p gqlgate-test -f compose.test.yaml logs
- name: Stop the stack
if: always()
run: docker compose -p gqlgate-test -f compose.test.yaml down -v
docker:
name: Build the image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: docker build --build-arg VERSION=ci -t gqlgate:ci .
- name: Smoke-test the binary
run: docker run --rm gqlgate:ci --version