-
-
Notifications
You must be signed in to change notification settings - Fork 7
84 lines (69 loc) · 2.8 KB
/
schema-linter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Schema Linter
on:
push:
branches:
- develop
pull_request:
branches:
- develop
- main
jobs:
run:
runs-on: ubuntu-latest
name: Lint WPGraphQL Schema
services:
mariadb:
image: mariadb:10
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
# Ensure docker waits for mariadb to start
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP w/ Composer & WP-CLI
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: mbstring, intl, bcmath, exif, gd, mysqli, opcache, zip, pdo_mysql
coverage: none
tools: composer, wp-cli
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Setup GraphQL Schema Linter
run: npm install -g graphql-schema-linter@^3.0 graphql@^16
- name: Setup WordPress
run: |
cp .env.dist .env
composer run install-test-env
- name: Generate the Static Schema
run: |
cd /tmp/wordpress/
# Output: /tmp/schema.graphql
wp graphql generate-static-schema
- name: Lint the Static Schema
run: |
graphql-schema-linter --except=relay-connection-types-spec,relay-page-info-spec --ignore '{"defined-types-are-used":["MenuItemsWhereArgs","PostObjectUnion","TermObjectUnion","TimezoneEnum"], "fields-have-descriptions":["WPGatsbyCompatibility","WPGatsbyPageNode","WPGatsbyPreviewStatus"], "enum-values-have-descriptions":["WPGatsbyRemotePreviewStatusEnum","WPGatsbyWPPreviewedNodeStatus"]}' /tmp/schema.graphql
- name: Display ignored linting errors
run: |
graphql-schema-linter /tmp/schema.graphql || true
- name: Get Latest tag
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: Test Schema for breaking changes
run: |
echo "Previous tagged schema ${{ steps.get-latest-tag.outputs.tag }}"
- name: Get Previous Released Schema
run: curl 'https://github.com/AxeWP/wp-graphql-rank-math/releases/download/${{ steps.get-latest-tag.outputs.tag }}/schema.graphql' -L --output /tmp/${{ steps.get-latest-tag.outputs.tag }}.graphql
# https://github.com/marketplace/actions/graphql-inspector
- name: Install Schema Inspector
run: |
npm install @graphql-inspector/config @graphql-inspector/cli graphql
- name: Run Schema Inspector
run: |
# This schema and previous release schema
node_modules/.bin/graphql-inspector diff /tmp/${{ steps.get-latest-tag.outputs.tag }}.graphql /tmp/schema.graphql