Skip to content

Test prod-style installation via composer from Drupal.org #415

Test prod-style installation via composer from Drupal.org

Test prod-style installation via composer from Drupal.org #415

name: Test prod-style installation via composer from Drupal.org
on:
schedule:
- cron: '0 8 * * *' # Run at 8AM UTC.
jobs:
prod-style-composer-install-from-drupal-dot-org:
name: Test prod-style installation via composer from Drupal.org
runs-on: ubuntu-latest
steps:
- name: Get a docker-compose.yml file approximating a production site
run: curl https://raw.githubusercontent.com/symbioquine/farmOS_wfs/2.x/docker/docker-compose.prod-demo.yml -o docker-compose.yml
- name: Start containers
run: docker-compose up -d
- name: Wait until www container is ready
run: until [ -f ./www/www-container-fs-ready ]; do sleep 0.1; done && while { ! exec 3<>/dev/tcp/localhost/5432; } > /dev/null 2>&1; do sleep 0.1; done
- name: Create the keys directory with the correct permissions
run: docker-compose exec -T www bash -c 'mkdir -p /opt/drupal/keys && chown -R www-data:www-data /opt/drupal/keys'
- name: Create the private files directory with the correct permissions
run: docker-compose exec -T www bash -c 'mkdir -p /opt/drupal/web/sites/default/private/files && chown -R www-data:www-data /opt/drupal/web/sites/default/private/files'
- name: Do a site-install
run: docker-compose exec -u www-data -T www bash -c 'drush site-install farm --locale=en --db-url=pgsql://farm:farm@db/farm --site-name=Test0 --account-name=root --account-pass=test'
- name: Add the private files directory config to settings.php
run: docker-compose exec -T www sh -c 'echo "\$settings[\"file_private_path\"] = \"/opt/drupal/web/sites/default/private/files\";" >> /opt/drupal/web/sites/default/settings.php'
- name: Enable oauth prereqs via drush
run: docker-compose exec -u www-data -T www drush en simple_oauth_password_grant farm_api_default_consumer
- name: Add farmOS_wfs from Drupal.org via composer
run: docker-compose exec -T www composer require --with-all-dependencies drupal/farmos_wfs
- name: Use drush to enable farmOS_wfs
run: docker-compose exec -u www-data -T www drush en farmos_wfs
- name: Perform Minimal Validation of a GetCapabilities Request
run: |
set -e
OAUTH2_ACCESS_TOKEN=`curl -X POST -d "grant_type=password&username=root&password=test&client_id=farm&scope=farm_manager" http://localhost/oauth/token | grep -Po 'access_token":"\K[^"]+'`
GET_CAPABILITIES_RESPONSE=`curl --header "Authorization: Bearer $OAUTH2_ACCESS_TOKEN" "http://localhost/wfs?SERVICE=WFS&REQUEST=GetCapabilities"`
echo $GET_CAPABILITIES_RESPONSE | grep -q '<ows:Title>farmOS OGC WFS API</ows:Title>'