-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (159 loc) · 5.31 KB
/
binaries-benchmark.yml
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: cli (benchmark Depot)
on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
permissions:
# Allow checks read
checks: write
# Allow repo checkout
contents: write
# Allow PRs write
pull-requests: write
# Allow issues write
issues: write
env:
GRAFBASE_SKIP_ASSET_VERSION_CHECK: "true"
CARGO_TERM_COLOR: "always"
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
DO_NOT_TRACK: 1
GRAFBASE_RUDDERSTACK_WRITE_KEY: ${{ secrets.GRAFBASE_RUDDERSTACK_WRITE_KEY }}
GRAFBASE_RUDDERSTACK_DATAPLANE_URL: ${{ secrets.GRAFBASE_RUDDERSTACK_DATAPLANE_URL }}
CLI_RELEASE_CLOUDFLARE_R2_ENDPOINT_URL: https://d267a8ab95268b272f5147e8939c9d38.r2.cloudflarestorage.com
CLI_RELEASE_CLOUDFLARE_R2_PUBLIC_URL: https://pub-b0013effd6614b32a4fb9bf338b90658.r2.dev
CLI_RELEASE_CLOUDFLARE_R2_BUCKET_NAME: cli-releases
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
detect-change-type:
runs-on: depot-ubuntu-latest
outputs:
build: ${{ steps.filter.outputs.build }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Path filter check
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
build:
- Dockerfile
- 'gateway/**/*'
- 'cli/**/*'
- 'engine/**/*'
- '.github/workflows/gateway.yml'
- '.github/actions/**/*'
- '!**/*.md'
lint:
name: "Lint"
needs: [detect-change-type]
if: ${{ needs.detect-change-type.outputs.build == 'true' || startsWith(github.ref, 'refs/tags/') }}
runs-on: depot-ubuntu-latest-8
steps:
- name: Get sources
uses: actions/checkout@v4
- name: Rust job init
uses: ./.github/actions/init_rust_job
with:
platform: linux
cache-key: ${{ runner.os }}-${{ runner.arch }}-cargo-dev-${{ hashFiles('Cargo.lock') }}
restore-key: ${{ runner.os }}-${{ runner.arch }}-cargo-dev
- name: Prepare Grafbase assets
uses: ./.github/actions/cli_assets
- name: Lint
uses: ./.github/actions/lint
individual-builds:
needs: [detect-change-type]
if: ${{ needs.detect-change-type.outputs.build == 'true' || startsWith(github.ref, 'refs/tags/') }}
strategy:
fail-fast: false
matrix:
package:
[
grafbase-local-common,
grafbase-local-server,
grafbase-local-backend,
grafbase,
grafbase-gateway,
federated-server,
]
runs-on: depot-ubuntu-latest-8
steps:
- name: Get sources
uses: actions/checkout@v4
- name: Rust job init
uses: ./.github/actions/init_rust_job
with:
platform: linux
cache-key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-${{ matrix.package }}-${{ hashFiles('Cargo.lock') }}
restore-key: ${{ runner.os }}-${{ runner.arch }}-cargo-build
- name: Build assets
if: ${{ matrix.package != 'grafbase-gateway' }}
uses: ./.github/actions/cli_assets
- name: Individual package build
shell: bash
run: |
set -euo pipefail
# The actual features used for each dependency depends on what is being built simultaneously.
# However, each package is published individually, so we're checking that all packages compile
# with only their defined features.
# See: https://github.com/rust-lang/cargo/issues/4463
cargo check --all-features --package ${{ matrix.package }}
- name: Individual package without lambda
if: ${{ matrix.package == 'grafbase-gateway' }}
shell: bash
run: |
set -euo pipefail
cargo check --package ${{ matrix.package }}
docker-grafbase:
runs-on: depot-ubuntu-latest-16
permissions:
packages: write
contents: read
id-token: write
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- name: Get sources
uses: actions/checkout@v4
with:
submodules: recursive
- uses: depot/setup-action@v1
- uses: depot/build-push-action@v1
with:
context: upstream/cli
tags: ghcr.io/grafbase/grafbase:$COMMIT_SHA
save: true
- name: Rust job init
uses: ./.github/actions/init_rust_job
with:
platform: linux
cache-key: ${{ runner.os }}-${{ runner.arch }}-cargo-dev-${{ hashFiles('Cargo.lock') }}
restore-key: ${{ runner.os }}-${{ runner.arch }}-cargo-dev
- name: Docker tests
run: |
GRAFBASE_DOCKER_IMAGE="ghcr.io/grafbase/grafbase:$COMMIT_SHA" RUST_BACKTRACE=1 cargo nextest run -p grafbase-docker-tests
docker-gateway:
runs-on: depot-ubuntu-latest-16
permissions:
packages: write
contents: read
id-token: write
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- name: Get sources
uses: actions/checkout@v4
with:
submodules: recursive
- uses: depot/setup-action@v1
- uses: depot/build-push-action@v1
with:
context: upstream/gateway
tags: ghcr.io/grafbase/gateway:$COMMIT_SHA
save: true