Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit 741b027

Browse files
Github action to check subgraph schema againt supergraph schema
1 parent cf6a867 commit 741b027

File tree

6 files changed

+41
-27
lines changed

6 files changed

+41
-27
lines changed

.github/workflows/schema.yml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ jobs:
1111
strategy:
1212
matrix:
1313
service:
14-
- compound_library
15-
- compound_soaking
16-
- crystal_library
17-
- soakdb_sync
18-
- pin_packing
19-
- targeting
14+
- name: compound_library
15+
publish: true
16+
- name: compound_soaking
17+
publish: true
18+
- name: crystal_library
19+
publish: true
20+
- name: soakdb_sync
21+
publish: false
22+
- name: pin_packing
23+
publish: false
24+
- name: targeting
25+
publish: false
2026
runs-on: ubuntu-latest
2127
steps:
2228
- name: Checkout source
@@ -36,23 +42,34 @@ jobs:
3642
with:
3743
command: run
3844
args: >
39-
--package ${{ matrix.service }}
45+
--package ${{ matrix.service.name }}
4046
--manifest-path backend/Cargo.toml
4147
schema
42-
--path ${{ matrix.service }}.graphql
48+
--path ${{ matrix.service.name }}.graphql
4349
4450
- name: Upload Schema Artifact
4551
uses: actions/upload-artifact@v4.3.1
4652
with:
47-
name: ${{ matrix.service }}.graphql
48-
path: ${{ matrix.service }}.graphql
53+
name: ${{ matrix.service.name }}.graphql
54+
path: ${{ matrix.service.name }}.graphql
4955

50-
- name: publish subgraph
56+
- name: check subgraph schema
57+
if: ${{ matrix.service.publish }}
58+
uses: danielsinclair/rover-setup@v1
59+
with:
60+
args: subgraph check xchemlab@current
61+
--schema ${{ matrix.service.name }}.graphql
62+
--name ${{ matrix.service.name }}
63+
env:
64+
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}
65+
66+
- name: publish subgraph schema
67+
if: ${{ matrix.service.publish == true }}
5168
uses: danielsinclair/rover-setup@v1
5269
with:
5370
args: subgraph publish xchemlab@current
54-
--routing-url http://${{ matrix.service }}:80
55-
--schema ${{ matrix.service }}.graphql
56-
--name ${{ matrix.service }}
71+
--routing-url http://${{ matrix.service.name }}:80
72+
--schema ${{ matrix.service.name }}.graphql
73+
--name ${{ matrix.service.name }}
5774
env:
5875
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}

backend/compound_library/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod migrator;
1212
/// through various entity structs.
1313
mod tables;
1414

15-
use async_graphql::extensions::Tracing;
15+
use async_graphql::{extensions::Tracing, SDLExportOptions};
1616
use axum::{routing::get, Router, Server};
1717
use clap::Parser;
1818
use graphql::{root_schema_builder, RootSchema};
@@ -132,8 +132,7 @@ async fn main() {
132132
}
133133
Cli::Schema(args) => {
134134
let schema = root_schema_builder().finish();
135-
let export_option = async_graphql::SDLExportOptions::default().federation();
136-
let schema_string = schema.sdl_with_options(export_option);
135+
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
137136
if let Some(path) = args.path {
138137
let mut file = File::create(path).unwrap();
139138
file.write_all(schema_string.as_bytes()).unwrap();

backend/compound_soaking/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod migrator;
1212
/// and subscriptions. It defines how data is queried and mutated through the API.
1313
mod tables;
1414

15-
use async_graphql::extensions::Tracing;
15+
use async_graphql::{extensions::Tracing, SDLExportOptions};
1616
use axum::{routing::get, Router, Server};
1717
use clap::Parser;
1818
use graphql::{root_schema_builder, RootSchema};
@@ -128,8 +128,7 @@ async fn main() {
128128
}
129129
Cli::Schema(args) => {
130130
let schema = root_schema_builder().finish();
131-
let export_option = async_graphql::SDLExportOptions::default().federation();
132-
let schema_string = schema.sdl_with_options(export_option);
131+
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
133132
if let Some(path) = args.path {
134133
let mut file = File::create(path).unwrap();
135134
file.write_all(schema_string.as_bytes()).unwrap();

backend/crystal_library/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod migrator;
1212
/// through various entity structs.
1313
mod tables;
1414

15-
use async_graphql::extensions::Tracing;
15+
use async_graphql::{extensions::Tracing, SDLExportOptions};
1616
use axum::{routing::get, Router, Server};
1717
use clap::Parser;
1818
use graphql::{root_schema_builder, RootSchema};
@@ -131,8 +131,7 @@ async fn main() {
131131
}
132132
Cli::Schema(args) => {
133133
let schema = root_schema_builder().finish();
134-
let export_option = async_graphql::SDLExportOptions::default().federation();
135-
let schema_string = schema.sdl_with_options(export_option);
134+
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
136135
if let Some(path) = args.path {
137136
let mut file = File::create(path).unwrap();
138137
file.write_all(schema_string.as_bytes()).unwrap();

backend/pin_packing/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod migrations;
55
mod resolvers;
66
mod tables;
77

8-
use async_graphql::extensions::Tracing;
8+
use async_graphql::{extensions::Tracing, SDLExportOptions};
99
use axum::{routing::get, Router, Server};
1010
use clap::Parser;
1111
use graphql::{root_schema_builder, RootSchema};
@@ -113,7 +113,7 @@ async fn main() {
113113
}
114114
Cli::Schema(args) => {
115115
let schema = root_schema_builder().finish();
116-
let schema_string = schema.sdl();
116+
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
117117
if let Some(path) = args.path {
118118
let mut file = File::create(path).unwrap();
119119
file.write_all(schema_string.as_bytes()).unwrap();

backend/targeting/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use async_graphql::extensions::Tracing;
1+
use async_graphql::{extensions::Tracing, SDLExportOptions};
22
use aws_credential_types::{provider::SharedCredentialsProvider, Credentials};
33
use aws_sdk_s3::{config::Region, Client};
44
use clap::{ArgAction::SetTrue, Parser};
@@ -125,7 +125,7 @@ async fn main() {
125125
}
126126
Cli::Schema(args) => {
127127
let schema = root_schema_builder().finish();
128-
let schema_string = schema.sdl();
128+
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
129129
if let Some(path) = args.path {
130130
let mut file = File::create(path).unwrap();
131131
file.write_all(schema_string.as_bytes()).unwrap();

0 commit comments

Comments
 (0)