-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Schema | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
generate: | ||
# 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 | ||
runs-on: ubuntu-latest | ||
services: | ||
ispyb: | ||
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0 | ||
ports: | ||
- 3306:3306 | ||
env: | ||
MARIADB_ROOT_PASSWORD: rootpassword | ||
options: > | ||
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect" | ||
env: | ||
DATABASE_URL: mysql://root:rootpassword@localhost:3306/ispyb_build | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4.1.2 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1.0.7 | ||
with: | ||
toolchain: stable | ||
default: true | ||
|
||
- name: Cache Rust Build | ||
uses: Swatinem/rust-cache@v2.7.3 | ||
|
||
- name: Generate Schema | ||
uses: actions-rs/cargo@v1.0.3 | ||
with: | ||
command: run | ||
args: > | ||
schema | ||
-- | ||
--path sessions.graphql | ||
- name: Upload Schema Artifact | ||
uses: actions/upload-artifact@v4.3.1 | ||
with: | ||
name: sessions.graphql | ||
path: sessions.graphql | ||
|
||
publish: | ||
# 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 | ||
needs: | ||
- generate | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Rover CLI | ||
run: | | ||
curl -sSL https://rover.apollo.dev/nix/v0.23.0-rc.3 | sh | ||
echo "$HOME/.rover/bin" >> $GITHUB_PATH | ||
- name: Download Schema Artifact | ||
uses: actions/download-artifact@v4.1.4 | ||
with: | ||
name: sessions.graphql | ||
path: sessions.graphql | ||
|
||
- name: Check Subgraph Schema | ||
run: > | ||
rover subgraph check data-gateway@current | ||
--schema sessions.graphql | ||
--name sessions | ||
env: | ||
APOLLO_KEY: ${{ secrets.APOLLO_STUDIO }} | ||
|
||
- name: Publish Subgraph Schema to Apollo Studio | ||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} | ||
run: > | ||
rover subgraph publish data-gateway@current | ||
--routing-url http://sessions:80 | ||
--schema sessions.graphql | ||
--name sessions | ||
env: | ||
APOLLO_KEY: ${{ secrets.APOLLO_STUDIO }} |