forked from shopware/shopware
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (71 loc) · 3.05 KB
/
01-lint-openapi.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
name: Lint OpenApi Schema
on:
push:
branches:
- trunk
paths:
- src/Core/Framework/Api/ApiDefinition/Generator/Schema/**/*
pull_request:
paths:
- src/Core/Framework/Api/ApiDefinition/Generator/Schema/**/*
jobs:
openapi-lint:
runs-on: ubuntu-latest
services:
database:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: root
options: '--mount="type=tmpfs,destination=/var/lib/mysql" --health-cmd="mysqladmin ping -h 127.0.0.1" --health-interval=5s --health-timeout=2s --health-retries=3'
ports:
- "3306:3306"
env:
APP_ENV: test
APP_URL: http://localhost:8000
APP_SECRET: def00000bb5acb32b54ff8ee130270586eec0e878f7337dc7a837acc31d3ff00f93a56b595448b4b29664847dd51991b3314ff65aeeeb761a133b0ec0e070433bff08e48
DATABASE_URL: mysql://root:[email protected]:3306/root
DATABASE_HOST: database
COMPOSER_ROOT_VERSION: 6.6.9999999.9999999-dev
steps:
- name: Clone platform
uses: actions/checkout@v4
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer Archives
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: gd, bcmath
tools: symfony-cli
- name: Remove vendor-bin
run: rm -R vendor-bin
- name: Setup Composer
run: composer install -o
- name: Install Shopware
run: composer run init:db
- name: Start Webserver
run: symfony server:start -d --no-tls
- name: Prepare schema lint
run: |
npm i -g @redocly/cli@latest @shopware/api-gen
export STOREFRONT_ID=$(bin/console sales-channel:list --output json | jq -r '.[] | select(.name == "Storefront") | .id')
export OPENAPI_ACCESS_KEY=$(mysql -u root -h 127.0.0.1 -proot root -se "SELECT access_key FROM sales_channel WHERE id = 0x${STOREFRONT_ID}";)
printf "OPENAPI_JSON_URL=http://localhost:8000\nSHOPWARE_ADMIN_USERNAME=admin\nSHOPWARE_ADMIN_PASSWORD=shopware\nOPENAPI_ACCESS_KEY=${OPENAPI_ACCESS_KEY}" > .env
- name: Generate & Lint OpenApi StoreAPI schema
run: |
api-gen generate --apiType=store && api-gen loadSchema --apiType=store
redocly lint --skip-rule operation-4xx-response --skip-rule no-server-example.com --skip-rule no-unused-components ./api-types/storeApiSchema.json
- name: Generate & Lint OpenApi API schema
run: |
api-gen generate --apiType=admin && api-gen loadSchema --apiType=admin
redocly lint --skip-rule operation-4xx-response --skip-rule no-server-example.com --skip-rule no-unused-components ./api-types/adminApiSchema.json