2020-06-05 15:41:28 +02:00
|
|
|
name: Run 2.x PHPUnit tests
|
2020-04-28 06:28:33 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2020-06-05 15:41:28 +02:00
|
|
|
- '2.x'
|
2020-11-23 21:08:08 +01:00
|
|
|
- '2.x-**'
|
2020-04-28 06:28:33 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Run PHPUnit tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-07-31 16:39:44 +02:00
|
|
|
- name: Checkout the repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set FARMOS_VERSION environment variable
|
2020-11-19 04:03:06 +01:00
|
|
|
run: echo "FARMOS_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
2020-08-12 16:09:35 +02:00
|
|
|
- name: Build farmOS 2.x Docker image
|
|
|
|
run: docker build --build-arg FARMOS_REPO=https://github.com/${GITHUB_REPOSITORY} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos/farmos:2.x docker
|
2020-07-31 19:28:35 +02:00
|
|
|
# This builds the dev Docker image using the specified FARMOS_VERSION,
|
|
|
|
# but notably it does NOT override the default PROJECT_VERSION, so the
|
|
|
|
# farmOS Composer project 2.x branch is always used.
|
2020-08-12 16:09:35 +02:00
|
|
|
- name: Build farmOS 2.x-dev Docker image
|
2020-11-23 19:23:01 +01:00
|
|
|
run: docker build --build-arg FARMOS_REPO=https://github.com/${GITHUB_REPOSITORY} --build-arg FARMOS_VERSION=${FARMOS_VERSION} --build-arg WWW_DATA_ID=33 -t farmos/farmos:2.x-dev docker/dev
|
2020-04-28 06:28:33 +02:00
|
|
|
- name: Create docker-compose.yml
|
2020-11-23 19:23:01 +01:00
|
|
|
run: cp docker/docker-compose.testing.yml docker-compose.yml
|
2020-04-28 06:28:33 +02:00
|
|
|
- name: Start containers
|
2020-11-23 19:23:01 +01:00
|
|
|
run: docker-compose up -d
|
2020-11-26 18:13:09 +01:00
|
|
|
- name: Wait until test-runner container is ready
|
|
|
|
# The test-runner-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/test-runner-container-fs-ready ]; do sleep 0.1; done
|
2020-08-18 14:40:41 +02:00
|
|
|
- name: Run PHPUnit tests
|
2020-11-23 19:23:01 +01:00
|
|
|
run: docker-compose exec -u www-data -T test-runner phpunit --verbose --debug --group farm
|
2020-08-18 14:40:41 +02:00
|
|
|
- name: Run PHP CodeSniffer
|
2020-11-23 19:23:01 +01:00
|
|
|
run: docker-compose exec -u www-data -T www phpcs /opt/drupal/web/profiles/farm
|