Merge branch 'next-36145/auto-imported-from-github' into 'trunk' #181
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint OpenApi Schema | |
on: | |
push: | |
branches: | |
- trunk | |
pull_request: | |
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: "dev" | |
APP_URL: http://localhost:8000 | |
APP_SECRET: def00000bb5acb32b54ff8ee130270586eec0e878f7337dc7a837acc31d3ff00f93a56b595448b4b29664847dd51991b3314ff65aeeeb761a133b0ec0e070433bff08e48 | |
DATABASE_URL: mysql://root:root@127.0.0.1:3306/root | |
DATABASE_HOST: database | |
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 | |
- name: Generate OpenApi schema | |
run: | | |
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 | |
npx @shopware/api-gen@canary loadSchema --apiType=store --filename=storeApiSchema.json | |
npx @shopware/api-gen@canary loadSchema --apiType=admin --filename=adminApiSchema.json | |
- name: Lint OpenApi schema | |
run: | | |
npm i -g @redocly/cli@latest | |
redocly lint --skip-rule operation-4xx-response --skip-rule no-server-example.com ./storeApiSchema.json | |
redocly lint --skip-rule operation-4xx-response --skip-rule no-server-example.com ./adminApiSchema.json | |