Skip to content

Commit

Permalink
add graphql inspector to check supergraph schema
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvigneshwars committed Jul 1, 2024
1 parent 606192f commit 868f233
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
37 changes: 25 additions & 12 deletions .github/workflows/schema-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,39 @@ jobs:
curl -sSL https://rover.apollo.dev/nix/v0.23.0-rc.3 | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Install graphql inspector
uses: borales/actions-yarn@v5.0.0
with:
cmd: global add @graphql-inspector/cli graphql

- name: Compose Schema
run: >
rover supergraph compose
--config schema/supergraph-config.yaml
--config supergraph-config.yaml
--elv2-license=accept
> supergraph.graphql
- name: Checkout main branch
uses: actions/checkout@v4.1.4
with:
ref: main

- name: Compose Previous Schema
run: >
rover supergraph compose
--config supergraph-config.yaml
--elv2-license=accept
> previous_supergraph.graphql
- name: Check composed schema
run: graphql-inspector diff previous_supergraph.graphql supergraph.graphql

- name: Upload Schema Artifact
uses: actions/upload-artifact@v4.3.3
with:
name: supergraph.graphql
path: supergraph.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
Expand All @@ -52,15 +71,13 @@ jobs:
uses: actions/download-artifact@v4.1.7
with:
name: supergraph.graphql

- name: Move Schema to Charts Directory
run: mv supergraph.graphql charts/supergraph/
path: charts/supergraph

- name: Package Chart
run: helm package charts/supergraph

- name: Generate Image Name
run: echo IMAGE_REPOSITORY=oci://ghcr.io/$(echo "${{ github.repository }}-supergraph/latest" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV
run: echo IMAGE_REPOSITORY=oci://ghcr.io/$(echo "${{ github.repository }}-supergraph" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV

- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
Expand All @@ -70,10 +87,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Chart with latest
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: helm push $(ls supergraph-*.tgz) ${{ env.IMAGE_REPOSITORY }}

- name: Publish Chart with stable
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
- name: Publish Chart
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: helm push $(ls supergraph-*.tgz) ${{ env.IMAGE_REPOSITORY }}
7 changes: 0 additions & 7 deletions charts/supergraph/templates/schema-configmap.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion schema/placeholder.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ schema {
}

type Query {
_empty: String
empty: String
}
6 changes: 0 additions & 6 deletions schema/supergraph-config.yaml

This file was deleted.

0 comments on commit 868f233

Please sign in to comment.