-
Notifications
You must be signed in to change notification settings - Fork 8
95 lines (82 loc) · 3.06 KB
/
generate-schema.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
85
86
87
88
89
90
91
92
93
94
95
name: Generate WPGraphQL Schema
on:
workflow_call:
inputs:
ref:
description: 'The branch or tag to checkout'
required: true
type: string
default: 'develop'
workflow_dispatch:
inputs:
ref:
description: 'The branch or tag to checkout'
required: true
type: string
default: 'develop'
jobs:
# TODO: This should check for an existing artifact before generating a new schema.
generate-schema:
name: Generate Schema from ref `${{ inputs.ref }}`
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout SnapWP Helper
uses: actions/checkout@v4
with:
repository: '${{ github.repository_owner }}/snapwp-helper'
path: '.'
ref: ${{ inputs.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, intl
coverage: none
tools: composer, wp-cli
- name: Install composer dependencies
uses: ramsey/composer-install@v3
with:
composer-options: '--no-progress'
- name: Setup GraphQL Schema Linter
run: npm install -g graphql-schema-linter@^3.0 graphql@^16
- name: Install Node.js dependencies
run: npm ci
env:
CI: true
- name: Build JS assets
run: npm run build:js
- name: Setup WordPress Test Environment
run: |
cd '${{ github.workspace }}'
cp .env.dist .env; set -a; source .env; set +a
npm run install-test-env
cd $WORDPRESS_ROOT_DIR
- name: Generarte Static Schema from ref `${{ inputs.ref }}`
run: |
cd '${{ github.workspace }}'
cp .env.dist .env; set -a; source .env; set +a
cd $WORDPRESS_ROOT_DIR
wp graphql generate-static-schema --allow-root
- name: Upload schema as release artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: schema
path: /tmp/schema.graphql
retention-days: 1
if-no-files-found: 'error'
overwrite: 'true'
outputs:
schema: ${{ steps.upload.outputs.artifact-url }}