Skip to content
Merged
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
9 changes: 9 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,12 @@ jobs:
with:
setup-go: "true"
- run: make test-ci
subgraphs-check:
name: Check GraphQL schemas
runs-on: ubuntu-latest
env:
COSMO_API_KEY: ${{ secrets.COSMO_API_KEY }}
steps:
- uses: actions/checkout@v6.0.2
- uses: ./.github/actions/setup
- run: make check-subgraphs
17 changes: 17 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
env:
COSMO_API_KEY: ${{ secrets.COSMO_API_KEY }}
steps:
- uses: actions/checkout@v6.0.2
- uses: ./.github/actions/setup
- run: make check-subgraphs
- run: make publish-ci
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ build-ci:
compose:
@pnpm compose

check-subgraphs:
@pnpm subgraphs:check

# Build linux plugin binary + Docker image (run `make compose` first if config.json is missing)
# for local development
# Usage: make docker-local
Expand All @@ -26,6 +29,9 @@ docker-local:
generate:
@pnpm generate

publish-ci:
@pnpm publish:ci

# Test all plugins
test:
@pnpm test
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Run `wgc demo` and make sure you are logged in to your Cosmo Cloud account. Foll
### Implementing `averageRating` field

1. Fork this repo.
2. Add `ROUTER_TOKEN` to your CI secrets (TBD - Github workflow)
2. Create a secret named `COSMO_API_KEY` for your forked repo with your private API key ([Studio API Keys documentation](https://cosmo-docs.wundergraph.com/studio/api-keys)).
3. In `plugins/reviews/src/schema.graphql` expand the schema file:

```diff
Expand All @@ -64,7 +64,7 @@ Run `wgc demo` and make sure you are logged in to your Cosmo Cloud account. Foll
```

4. Run `make generate` in `plugins/reviews` directory to generate gRPC methods.
5. Add the new field `AverageRating` to the `Product` struct, using `calculateAverageRating` function that is provided:
5. Add the new field `AverageRating` to the `Product` struct in `plugins/reviews/src/main.go`. Use the `calculateAverageRating` function that is provided to implement the calculation:

```diff
@@ -62,6 +62,7 @@ func (s *ReviewsService) LookupProductById(ctx context.Context, req *service.Loo
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"build": "pnpm -r build",
"build:ci": "pnpm -r --workspace-concurrency=1 build:ci",
"compose": "wgc router compose -i ./plugins/graph.yaml -o ./config.json",
"subgraphs:check": "pnpm -r subgraph:check",
"format": "pnpm -r format",
"generate": "pnpm -r generate",
"lint": "pnpm -r lint",
"lint:ci": "pnpm -r lint:ci",
"publish:ci": "pnpm -r --workspace-concurrency=1 publish:ci",
"test": "pnpm -r test",
"test:ci": "pnpm -r --workspace-concurrency=1 test:ci",
"start": "pnpm build && pnpm compose && make docker-local && docker run --rm -p 3002:3002 cosmo-demo-local"
Expand Down
2 changes: 2 additions & 0 deletions plugins/products/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"generate": "wgc router plugin generate .",
"lint": "golangci-lint run ./...",
"lint:ci": "golangci-lint run --allow-parallel-runners ./...",
"publish:ci": "wgc router plugin publish --namespace default --label graph=demo --fail-on-composition-error .",
"subgraph:check": "wgc subgraph check reviews --namespace default --label graph=demo --schema ./src/schema.graphql",
"test": "wgc router plugin test .",
"test:ci": "wgc router plugin test . --yes"
},
Expand Down
2 changes: 2 additions & 0 deletions plugins/reviews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"generate": "wgc router plugin generate .",
"lint": "golangci-lint run ./...",
"lint:ci": "golangci-lint run --allow-parallel-runners ./...",
"publish:ci": "wgc router plugin publish --namespace default --label graph=demo --fail-on-composition-error .",
"subgraph:check": "wgc subgraph check reviews --namespace default --label graph=demo --schema ./src/schema.graphql",
"test": "wgc router plugin test .",
"test:ci": "wgc router plugin test . --yes"
},
Expand Down