Run 2.x tests #1551
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: Run 2.x tests | |
on: | |
schedule: | |
- cron: '0 8 * * *' # Run at 8AM UTC. | |
push: | |
branches: | |
- '2.x' | |
- '2.x-**' | |
pull_request: | |
branches: | |
- '2.x' | |
jobs: | |
run-tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
env: | |
MODULE_NAME: farm_rothamsted | |
PACKAGE_NAME: farmier/farm_rothamsted | |
steps: | |
- name: Checkout this repository | |
uses: actions/checkout@v3 | |
with: | |
path: ${{ env.MODULE_NAME }} | |
- name: Run farmOS development environment containers. | |
run: | | |
curl -O https://raw.githubusercontent.com/farmOS/farmOS/3.x/docker/docker-compose.testing.common.yml | |
curl -O https://raw.githubusercontent.com/farmOS/farmOS/3.x/docker/docker-compose.testing.pgsql.yml | |
docker compose -f docker-compose.testing.common.yml -f docker-compose.testing.pgsql.yml config > docker-compose.yml | |
docker compose up -d | |
env: | |
DB_URL: pgsql://farm:farm@db/farm | |
- name: Wait until www container is ready | |
# The www-container-fs-ready file is only created once we expect the | |
# containers to be online so waiting for that lets us know it is safe to | |
# start the tests. | |
run: until [ -f ./www/www-container-fs-ready ]; do sleep 0.1; done | |
- name: Install the module via Composer | |
run: | | |
sudo mv ${MODULE_NAME} www/${MODULE_NAME} | |
docker compose exec -u www-data -T www composer config repositories.${MODULE_NAME} path ./${MODULE_NAME} | |
docker compose exec -u www-data -T www composer update | |
docker compose exec -u www-data -T www composer require ${PACKAGE_NAME}:* | |
- name: Run PHP CodeSniffer | |
run: docker compose exec -u www-data -T www phpcs /opt/drupal/web/modules/${MODULE_NAME} --exclude=DrupalPractice.InfoFiles.NamespacedDependency | |
- name: Run PHPUnit tests | |
run: docker compose exec -u www-data -T www phpunit --verbose --debug /opt/drupal/web/modules/${MODULE_NAME} | |
- name: Test installing farmOS and the module | |
run: | | |
docker compose exec -u www-data -T www drush site-install --db-url=pgsql://farm:farm@db/farm farm farm.modules='base' | |
docker compose exec -u www-data -T www drush en farm_rothamsted farm_rothamsted_quick farm_rothamsted_experiment farm_rothamsted_experiment_research -y | |
docker compose exec -u www-data -T www drush en farm_rothamsted_dev -y |