Skip to content

Merge pull request #80 from markkelnar/ci-zip-subfolder #112

Merge pull request #80 from markkelnar/ci-zip-subfolder

Merge pull request #80 from markkelnar/ci-zip-subfolder #112

Workflow file for this run

name: Schema Linter
on:
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main
jobs:
run:
runs-on: ubuntu-latest
name: Lint WPGraphQL Schema
services:
mariadb:
image: mariadb:10.8.2
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@v2
- name: Setup PHP w/ Composer & WP-CLI
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: mbstring, intl, bcmath, exif, gd, mysqli, opcache, zip, pdo_mysql
coverage: none
tools: composer, wp-cli
- name: Install dependencies
run: composer install --no-dev
- name: Setup WordPress
run: |
composer run install-test-env
env:
ACF_LICENSE_KEY: ${{secrets.ACF_LICENSE_KEY}}
- name: Install WP CLI for ACF
run: |
cd /tmp/wordpress/
wp --allow-root plugin install https://github.com/hoppinger/advanced-custom-fields-wpcli/archive/refs/heads/master.zip --activate
- name: Import test Field Group
run: |
cd /tmp/wordpress/
wp --allow-root acf import --json_file="${GITHUB_WORKSPACE}/tests/_data/acf-basic-fields.json"
- name: Generate the Static Schema
run: |
cd /tmp/wordpress/
# Output: /tmp/schema.graphql
wp --allow-root graphql generate-static-schema
- name: Install GraphQL Schema Linter
run: npm install -g graphql-schema-linter@^3.0 graphql@^16
- name: Lint the Static Schema
run: |
graphql-schema-linter --except=relay-connection-types-spec,relay-page-info-spec /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/wp-graphql/wp-graphql-acf-2/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