-
Notifications
You must be signed in to change notification settings - Fork 23
/
config.yml
218 lines (198 loc) · 5.98 KB
/
config.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
version: 2.1
# Our CircleCI dependencies
orbs:
rust: circleci/rust@1.6.1
secops: apollo/circleci-secops-orb@2.0.7
release: &release
filters:
branches:
ignore: /.*/
tags: # To trigger a release, push a tag with the format `package-name@vversion`. Like `apollo-composition@v0.1.0`
only: /(apollo-federation-types@v.*)|(router-bridge@v.*)|(apollo-composition@v.*)/
parameters:
# we can't easily pin on osx
linux_cmake_version:
type: string
default: '3.27.3'
# The main workflows executed for federation-rs
workflows:
lint:
jobs:
- lint
test:
jobs:
- test:
name: Run cargo tests on << matrix.platform >>
matrix:
parameters:
platform: [ amd_ubuntu, arm_ubuntu, arm_macos ]
release:
jobs:
- test:
name: Run cargo tests on << matrix.platform >>
matrix:
parameters:
platform: [ amd_ubuntu, arm_ubuntu, arm_macos ]
<<: *release
- publish_release:
name: Publish to crates.io
requires:
- "Run cargo tests on amd_ubuntu"
- "Run cargo tests on arm_ubuntu"
- "Run cargo tests on arm_macos"
<<: *release
security-scans:
jobs:
- secops/gitleaks:
context:
- platform-docker-ro
- github-orb
- secops-oidc
git-base-revision: <<#pipeline.git.base_revision>><<pipeline.git.base_revision>><</pipeline.git.base_revision >>
git-revision: << pipeline.git.revision >>
- secops/semgrep:
context:
- secops-oidc
- github-orb
git-base-revision: <<#pipeline.git.base_revision>><<pipeline.git.base_revision>><</pipeline.git.base_revision >>
jobs:
lint:
executor: amd_ubuntu
steps:
- checkout
- install_system_deps:
platform: amd_ubuntu
- run:
name: Check Rust formatting
command: cargo fmt --all -- --check
- run:
name: Check Rust lints
command: cargo clippy -- -D warnings
- run:
name: Lint JavaScript
command: npm run --prefix router-bridge lint
test:
parameters:
platform:
type: executor
executor: << parameters.platform >>
steps:
- checkout
- install_system_deps:
platform: << parameters.platform >>
- run:
name: Run cargo tests
command: cargo test
publish_release:
executor: minimal_linux
steps:
- checkout
# this is run in order to create the JavaScript bundles
# that are needed by `cargo publish`, which is only necessary for router-bridge
- when:
condition:
matches:
pattern: ^router-bridge@.*
value: << pipeline.git.tag >>
steps:
- install_system_deps:
platform: minimal_linux
- run:
command: cargo build --release --target $RUSTUP_TARGET
- when: # Don't need Node stuff, just install Rust
condition:
not:
matches:
pattern: ^router-bridge@.*
value: << pipeline.git.tag >>
steps:
- rust/install
- run:
name: Publish to crates.io
command: |
# The tag looks like `<package-name>@v<version>`, but cargo wants `<package-name>@<version>`
CARGO_VERSION=$(echo $CIRCLE_TAG | sed 's/@v/@/')
# If this is router-bridge, we need to `--allow-dirty` for the JavaScript bundle
if [ "$PACKAGE_NAME" == "router-bridge"* ]; then
cargo publish -p $CARGO_VERSION --allow-dirty
else
cargo publish -p $CARGO_VERSION
fi
# The machines we use to run our workflows on
executors:
arm_macos: &arm_macos_executor
macos:
xcode: "15.4.0"
resource_class: macos.m1.medium.gen1
environment:
RUSTUP_TARGET: "aarch64-apple-darwin"
APPLE_TEAM_ID: "YQK948L752"
APPLE_USERNAME: "opensource@apollographql.com"
MACOS_PRIMARY_BUNDLE_ID: com.apollographql.supergraph
amd_ubuntu:
machine:
image: ubuntu-2004:current
resource_class: xlarge
environment:
RUSTUP_TARGET: "x86_64-unknown-linux-gnu"
arm_ubuntu:
machine:
image: ubuntu-2004:current
resource_class: arm.large
environment:
RUSTUP_TARGET: "aarch64-unknown-linux-gnu"
minimal_linux:
docker:
- image: cimg/base:stable
resource_class: small
environment:
RUSTUP_TARGET: "x86_64-unknown-linux-gnu"
# reusable command snippets can be referred to in any `steps` object
commands:
install_system_deps:
parameters:
platform:
type: executor
steps:
- when:
condition:
equal: [ *arm_macos_executor, << parameters.platform >> ]
steps:
- run:
name: Install CMake
command: brew install cmake
- install_rust_toolchain:
platform: << parameters.platform >>
- install_volta:
platform: << parameters.platform >>
install_volta:
parameters:
platform:
type: executor
steps:
- run:
name: Install volta
command: |
curl https://get.volta.sh | bash -s -- --skip-setup
echo 'export VOLTA_HOME=$HOME/.volta' >> $BASH_ENV
echo 'export PATH=$VOLTA_HOME/bin:$PATH' >> $BASH_ENV
- run:
name: Install default versions of npm and node
command: |
volta install node@16
volta install npm@8
install_rust_toolchain:
parameters:
platform:
type: executor
steps:
- rust/install
- run:
name: Adds rust target
command: rustup target add $RUSTUP_TARGET
- run:
name: Set default rustc version
# router-bridge does not currently work on newer Rust versions
command: |
rustup install 1.76.0
rustup default 1.76.0