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

Subgraph GitHub actions #384

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 38 additions & 8 deletions .github/workflows/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ on:
pull_request:

jobs:
generate_schema:
generate_and_publish_schema:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
service:
- soakdb_sync
- pin_packing
- targeting
- name: compound_library
publish: true
- name: compound_soaking
publish: true
- name: crystal_library
publish: true
- name: soakdb_sync
publish: false
- name: pin_packing
publish: false
- name: targeting
publish: false
garryod marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- name: Checkout source
Expand All @@ -33,13 +42,34 @@ jobs:
with:
command: run
args: >
--package ${{ matrix.service }}
--package ${{ matrix.service.name }}
--manifest-path backend/Cargo.toml
schema
--path ${{ matrix.service }}.graphql
--path ${{ matrix.service.name }}.graphql

- name: Upload Schema Artifact
uses: actions/upload-artifact@v4.3.1
with:
name: ${{ matrix.service }}.graphql
path: ${{ matrix.service }}.graphql
name: ${{ matrix.service.name }}.graphql
path: ${{ matrix.service.name }}.graphql

- name: check subgraph schema
if: ${{ matrix.service.publish }}
uses: danielsinclair/rover-setup@v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a fully qualified version?

with:
args: subgraph check xchemlab@current
--schema ${{ matrix.service.name }}.graphql
--name ${{ matrix.service.name }}
Comment on lines +60 to +62
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
args: subgraph check xchemlab@current
--schema ${{ matrix.service.name }}.graphql
--name ${{ matrix.service.name }}
args: |
subgraph check xchemlab@current
--schema ${{ matrix.service.name }}.graphql
--name ${{ matrix.service.name }}

env:
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}

- name: publish subgraph schema
if: ${{ matrix.service.publish == true }}
uses: danielsinclair/rover-setup@v1
with:
args: subgraph publish xchemlab@current
--routing-url http://${{ matrix.service.name }}:80
--schema ${{ matrix.service.name }}.graphql
--name ${{ matrix.service.name }}
Comment on lines +70 to +73
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
args: subgraph publish xchemlab@current
--routing-url http://${{ matrix.service.name }}:80
--schema ${{ matrix.service.name }}.graphql
--name ${{ matrix.service.name }}
args: |
subgraph publish xchemlab@current
--routing-url http://${{ matrix.service.name }}:80
--schema ${{ matrix.service.name }}.graphql
--name ${{ matrix.service.name }}

env:
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}
4 changes: 2 additions & 2 deletions backend/compound_library/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod migrator;
/// through various entity structs.
mod tables;

use async_graphql::extensions::Tracing;
use async_graphql::{extensions::Tracing, SDLExportOptions};
use axum::{routing::get, Router, Server};
use clap::Parser;
use graphql::{root_schema_builder, RootSchema};
Expand Down Expand Up @@ -132,7 +132,7 @@ async fn main() {
}
Cli::Schema(args) => {
let schema = root_schema_builder().finish();
let schema_string = schema.sdl();
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
if let Some(path) = args.path {
let mut file = File::create(path).unwrap();
file.write_all(schema_string.as_bytes()).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions backend/compound_soaking/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod migrator;
/// and subscriptions. It defines how data is queried and mutated through the API.
mod tables;

use async_graphql::extensions::Tracing;
use async_graphql::{extensions::Tracing, SDLExportOptions};
use axum::{routing::get, Router, Server};
use clap::Parser;
use graphql::{root_schema_builder, RootSchema};
Expand Down Expand Up @@ -128,7 +128,7 @@ async fn main() {
}
Cli::Schema(args) => {
let schema = root_schema_builder().finish();
let schema_string = schema.sdl();
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
if let Some(path) = args.path {
let mut file = File::create(path).unwrap();
file.write_all(schema_string.as_bytes()).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions backend/crystal_library/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod migrator;
/// through various entity structs.
mod tables;

use async_graphql::extensions::Tracing;
use async_graphql::{extensions::Tracing, SDLExportOptions};
use axum::{routing::get, Router, Server};
use clap::Parser;
use graphql::{root_schema_builder, RootSchema};
Expand Down Expand Up @@ -131,7 +131,7 @@ async fn main() {
}
Cli::Schema(args) => {
let schema = root_schema_builder().finish();
let schema_string = schema.sdl();
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
if let Some(path) = args.path {
let mut file = File::create(path).unwrap();
file.write_all(schema_string.as_bytes()).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions backend/pin_packing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod migrations;
mod resolvers;
mod tables;

use async_graphql::extensions::Tracing;
use async_graphql::{extensions::Tracing, SDLExportOptions};
use axum::{routing::get, Router, Server};
use clap::Parser;
use graphql::{root_schema_builder, RootSchema};
Expand Down Expand Up @@ -113,7 +113,7 @@ async fn main() {
}
Cli::Schema(args) => {
let schema = root_schema_builder().finish();
let schema_string = schema.sdl();
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
if let Some(path) = args.path {
let mut file = File::create(path).unwrap();
file.write_all(schema_string.as_bytes()).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions backend/targeting/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use async_graphql::extensions::Tracing;
use async_graphql::{extensions::Tracing, SDLExportOptions};
use aws_credential_types::{provider::SharedCredentialsProvider, Credentials};
use aws_sdk_s3::{config::Region, Client};
use clap::{ArgAction::SetTrue, Parser};
Expand Down Expand Up @@ -125,7 +125,7 @@ async fn main() {
}
Cli::Schema(args) => {
let schema = root_schema_builder().finish();
let schema_string = schema.sdl();
let schema_string = schema.sdl_with_options(SDLExportOptions::default().federation());
if let Some(path) = args.path {
let mut file = File::create(path).unwrap();
file.write_all(schema_string.as_bytes()).unwrap();
Expand Down
Loading