Schema #15
Workflow file for this run
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: Schema | ||
env: | ||
PHP_VERSION: '8.1' | ||
MYSQL_VERSION: '8.0' | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
updated_module: | ||
description: the module that triggered the schema workflow | ||
require: true | ||
type: string | ||
updated_module_version: | ||
description: the version of the triggering module | ||
require: true | ||
type: string | ||
# doc_version: | ||
# description: version where the schema should be generated for | ||
# required: true | ||
# default: '8.0' | ||
# type: choice | ||
# options: | ||
# base_version: | ||
# description: graphql-base version for schema generation | ||
# required: true | ||
# default: latest | ||
# type: string | ||
# storefront_version: | ||
# description: graphql-storefront version for schema generation | ||
# required: true | ||
# default: latest | ||
# type: string | ||
# configuration_access_version: | ||
# description: graphql-configuration access version for schema generation | ||
# required: true | ||
# default: latest | ||
# type: string | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone testing environment | ||
run: | | ||
git clone https://github.com/OXID-eSales/docker-eshop-sdk.git . | ||
git clone https://github.com/OXID-eSales/docker-eshop-sdk-recipes recipes/oxid-esales | ||
- name: Clone the shop | ||
run: git clone --depth 1 https://github.com/OXID-eSales/oxideshop_ce.git --branch b-7.0.x --single-branch source | ||
- name: Prepare container configuration | ||
run: | | ||
make setup | ||
make addbasicservices | ||
perl -pi\ | ||
-e "s#PHP_VERSION=.*#PHP_VERSION='${{ env.PHP_VERSION }}'#g;"\ | ||
-e "s#MYSQL_VERSION=.*#MYSQL_VERSION='${{ env.MYSQL_VERSION }}'#g;"\ | ||
.env | ||
perl -pi\ | ||
-e 's#display_errors =.*#display_errors = false#g;'\ | ||
-e 'print "xdebug.max_nesting_level=1000\nxdebug.mode=coverage\n\n";'\ | ||
-e 'print "error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING\n"'\ | ||
containers/php/custom.ini | ||
perl -pi\ | ||
-e 's#/var/www/#/var/www/source/#g;'\ | ||
containers/httpd/project.conf | ||
- name: Prepare shop configuration | ||
run: | | ||
cp source/source/config.inc.php.dist source/source/config.inc.php | ||
perl -pi\ | ||
-e 'print "SetEnvIf Authorization \"(.*)\" HTTP_AUTHORIZATION=\$1\n\n" if $. == 1'\ | ||
source/source/.htaccess | ||
perl -pi\ | ||
-e 's#<dbHost>#mysql#g;'\ | ||
-e 's#<dbUser>#root#g;'\ | ||
-e 's#<dbName>#example#g;'\ | ||
-e 's#<dbPwd>#root#g;'\ | ||
-e 's#<dbPort>#3306#g;'\ | ||
-e 's#<sShopURL>#http://localhost/#g;'\ | ||
-e 's#<sShopDir>#/var/www/source/#g;'\ | ||
-e 's#<sCompileDir>#/var/www/source/tmp/#g;'\ | ||
source/source/config.inc.php | ||
- name: Start containers | ||
run: | | ||
make up | ||
sleep 2 | ||
- name: Install module and dependencies if base | ||
if: ${{ inputs.updated_module != graphql_storefront }} | ||
Check failure on line 98 in .github/workflows/schema.yml GitHub Actions / SchemaInvalid workflow file
|
||
run: | | ||
docker-compose exec -T php composer require oxid-esales/graphql-base:${{inputs.updated_module_version}} --no-update | ||
docker-compose exec -T php composer require oxid-esales/graphql-storefront --no-update | ||
docker-compose exec -T php composer update --no-interaction | ||
- name: Install module and dependencies if storefront | ||
if: ${{ inputs.updated_module == graphql_storefront }} | ||
run: | | ||
docker-compose exec -T php composer require oxid-esales/graphql-storefront:${{inputs.updated_module_version}} --no-update | ||
docker-compose exec -T php composer update --no-interaction | ||
- name: Get documentation version for schema | ||
run: DOCUMENTATION_VERSION = ${docker-compose exec -T php composer show 'oxid-esales/graphql-base' | sed -n '/versions/s/^[^0-9]\+\([^,]\+\).[^0-9]$/\1/p'} | ||
- name: Install module and dependencies | ||
run: | | ||
docker-compose exec -T php composer require oxid-esales/graphql-storefront --no-update | ||
docker-compose exec -T php composer update --no-interaction | ||
- name: Reset shop | ||
run: | | ||
docker-compose exec -T \ | ||
php bin/oe-console oe:database:reset --db-host=mysql --db-port=3306 \ | ||
--db-name=example --db-user=root --db-password=root --force | ||
- name: Activate modules | ||
run: | | ||
docker-compose exec -T php php bin/oe-console oe:module:activate oe_graphql_base | ||
docker-compose exec -T php php bin/oe-console oe:module:activate oe_graphql_storefront | ||
- name: Checkout documentation | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: schema | ||
path: $GITHUB_WORKSPACE/docs/_static/schema | ||
- name: Remove old schema for version | ||
run: | | ||
if [ -d "$GITHUB_WORKSPACE/docs/_static/schema/$DOCUMENTATION_VERSION" ]; then | ||
rm -Rf $GITHUB_WORKSPACE/docs/_static/schema/$DOCUMENTATION_VERSION; | ||
fi | ||
- name: Generate documentation | ||
run: | | ||
./recipes/oxid-esales/parts/shared/create_admin.sh | ||
sudo npm install -g @2fd/graphdoc | ||
sleep 2; | ||
TOKEN=$(curl --silent http://localhost/graphql?skipSession=1 -H 'Content-Type: application/json' --data-binary '{"query":"query {token(username: \"[email protected]\", password:\"admin\")}"}' | sed -n 's|.*"token":"\(.*\)\"}}|\1|p') | ||
graphdoc -e http://localhost/graphql?skipSession=1 -o $GITHUB_WORKSPACE/docs/_static/schema/$DOCUMENTATION_VERSION -f -x "Authorization: Bearer $TOKEN" | ||
# - name: Deploy | ||
# uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
# with: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# BRANCH: schema | ||
# FOLDER: docs/_static/schema |