Skip to content

Commit

Permalink
GitHub Actions for Apigee API Catalog (#186)
Browse files Browse the repository at this point in the history
GitHub Actions for Apigee API Catalog 
Tested against
* Drupal 9.2 and  9.3
* PHP 7.4 and 8.0
  • Loading branch information
phdhiren authored May 2, 2022
1 parent 9ff5bfd commit 099d72a
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 2 deletions.
128 changes: 128 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: test_and_lint
env:
SIMPLETEST_DB: "sqlite://localhost//tmp/test.sqlite"
SIMPLETEST_BASE_URL: "http://127.0.0.1:8000"
APIGEE_EDGE_AUTH_TYPE: ${{ secrets.APIGEE_EDGE_AUTH_TYPE }}
APIGEE_EDGE_ORGANIZATION: ${{ secrets.APIGEE_EDGE_ORGANIZATION }}
APIGEE_EDGE_USERNAME: ${{ secrets.APIGEE_EDGE_USERNAME }}
APIGEE_EDGE_PASSWORD: ${{ secrets.APIGEE_EDGE_PASSWORD }}
APIGEE_EDGE_INSTANCE_TYPE: ${{ secrets.APIGEE_EDGE_INSTANCE_TYPE }}
APIGEE_INTEGRATION_ENABLE: ${{ secrets.APIGEE_INTEGRATION_ENABLE }}
APIGEE_EDGE_ENDPOINT: ${{ secrets.APIGEE_EDGE_ENDPOINT }}
SYMFONY_DEPRECATIONS_HELPER: "disabled"
BROWSERTEST_OUTPUT_DIRECTORY: "sites/simpletest/browser_output"
BROWSERTEST_OUTPUT_BASE_URL: ""
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", { "chromeOptions": { "w3c": false } }, "http://127.0.0.1:9515/wd/hub"]'

on:
push:
pull_request_target:

jobs:
build:

runs-on: ubuntu-latest

name: "PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal-core }}"
strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
# - "8.1"
drupal-core:
# Should update the following as the minimum supported version from Drupal.org
- "9.2.x"
- "9.3.x"
exclude:
- php-version: "8.1"
drupal-core: "9.2.x"

steps:

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: composer:v2
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv, opcache, imagick

- name: Checkout Drupal core
run: |
git clone --depth 1 --branch ${{ matrix.drupal-core }} https://github.com/drupal/drupal.git drupal
mkdir -p drupal/modules/contrib/apigee_api_catalog
mkdir -p drupal/sites/simpletest/browser_output
- name: Checkout apigee_api_catalog module
uses: actions/[email protected]
with:
path: drupal/modules/contrib/apigee_api_catalog

- name: "Allow plugins and dev dependencies"
run: |
cd drupal
composer config --no-plugins allow-plugins.composer/installers true
composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true
composer config --no-plugins allow-plugins.drupal/core-project-message true
composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config --no-plugins allow-plugins.wikimedia/composer-merge-plugin true
composer config --no-plugins allow-plugins.composer/package-versions-deprecated true
composer config --no-plugins allow-plugins.cweagans/composer-patches true
composer require --dev drush/drush
composer config minimum-stability dev
composer require drupal/rules:3.0.0-alpha7
composer require wikimedia/composer-merge-plugin
composer config --json extra.merge-plugin.require '["modules/contrib/apigee_api_catalog/composer.json"]'
composer config platform.php ${{ matrix.php-version }}
composer config --json extra.patches."drupal/core" '{ "Support entities that are neither content nor config entities": "https://www.drupal.org/files/issues/2020-12-02/3042467-50.patch"}'
composer update --with-all-dependencies
composer require --dev phpspec/prophecy-phpunit:^2
# Install drupal using minimal installation profile and enable the module.
- name: Install Drupal
run: |
cd drupal
php -d sendmail_path=$(which true); vendor/bin/drush --yes -v site-install minimal --db-url="$SIMPLETEST_DB"
vendor/bin/drush rs 8000 &
- name: "PHPCS"
run: |
cd drupal
cp modules/contrib/apigee_api_catalog/phpcs.xml.dist .
vendor/bin/phpcs --standard=./phpcs.xml.dist modules/contrib/apigee_api_catalog -p -s -n --colors
composer show > composer.show.txt
- name: Artifacts
uses: actions/upload-artifact@v3
with:
name: composer-${{ matrix.php-version }}-${{ matrix.drupal-core }}-artifact
path: drupal/composer.*

- name: "PHPUnit unit"
run: |
cd drupal
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite unit
- name: "PHPUnit kernel"
run: |
cd drupal
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite kernel
- uses: nanasess/setup-chromedriver@v1

- run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- name: "PHPUnit functional javascript"
run: |
cd drupal
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite functional-javascript
- name: "PHPUnit functional"
run: |
cd drupal
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite functional
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"cweagans/composer-patches": "^1.6",
"drupal/core-dev": "^9.2.13",
"drush/drush": "^9.0 || ^10.0",
"mglaman/drupal-check": "^1.1",
"mglaman/drupal-check": "^1.3",
"phpmd/phpmd": "2.8.2",
"phpmetrics/phpmetrics": "^2.5",
"phpstan/phpstan": "0.12.42"
"phpstan/phpstan": "^1.5"
},
"config": {
"sort-packages": true
Expand Down

0 comments on commit 099d72a

Please sign in to comment.