forked from wundergraph/cosmo
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (82 loc) · 2.66 KB
/
graphqlmetrics-ci.yaml
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
name: GraphQLMetrics CI
on:
pull_request:
paths:
- "graphqlmetrics/**/*"
- ".github/workflows/graphqlmetrics-ci.yaml"
concurrency:
group: ${{github.workflow}}-${{github.head_ref}}
cancel-in-progress: true
env:
CI: true
INT_TESTS: true
jobs:
build_test:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
clickhouse:
# Docker Hub image
image: clickhouse/clickhouse-server:24
ports:
- "8123:8123"
- "9000:9000"
env:
CLICKHOUSE_DB: cosmo
CLICKHOUSE_USER: default
CLICKHOUSE_PASSWORD: changeme
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
# The go install / version instructions are inside the Makefile, so we need to cache the Makefile.
key: ${{ runner.os }}-go-${{ hashFiles('graphqlmetrics/go.sum') }}-makefile-${{ hashFiles('Makefile') }}
restore-keys: |
${{ runner.os }}-go-
- uses: ./.github/actions/go
with:
cache-dependency-path: graphqlmetrics/go.sum
- uses: ./.github/actions/go-mod-tidy
with:
working-directory: ./graphqlmetrics
- name: Install tools
run: make setup-build-tools
- name: Generate code
run: rm -rf graphqlmetrics/gen && buf generate --path proto/wg/cosmo/graphqlmetrics --path proto/wg/cosmo/common --template buf.graphqlmetrics.go.gen.yaml
- name: Check if git is not dirty after generating files
run: git diff --no-ext-diff --exit-code
- name: Install dependencies
working-directory: ./graphqlmetrics
run: go mod download
- uses: ./.github/actions/go-linter
with:
working-directory: ./graphqlmetrics
env-go-work: 'off'
- name: Test
working-directory: ./graphqlmetrics
run: make test
- name: Build
working-directory: ./graphqlmetrics
run: make build
build_push_image:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/build-push-image
with:
docker_username: ${{secrets.DOCKER_USERNAME}}
docker_password: ${{secrets.DOCKER_PASSWORD}}
docker_context: graphqlmetrics
dockerfile: graphqlmetrics/Dockerfile
token: ${{secrets.GITHUB_TOKEN}}
image_name: graphqlmetrics
image_description: "Cosmo GraphQL Metrics Collector"