3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00
farmOS/.github/workflows/run-tests.yml

36 lines
1.7 KiB
YAML
Raw Normal View History

name: Run 2.x PHPUnit tests
on:
push:
branches:
- '2.x'
- '2.x-**'
jobs:
build:
name: Run PHPUnit tests
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Set FARMOS_VERSION environment variable
run: echo "FARMOS_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- 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
# 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.
- name: Build farmOS 2.x-dev Docker image
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
- name: Create docker-compose.yml
run: cp docker/docker-compose.testing.yml docker-compose.yml
- name: Start containers
run: docker-compose up -d
- 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
- name: Run PHPUnit tests
run: docker-compose exec -u www-data -T test-runner phpunit --verbose --debug --group farm
- name: Run PHP CodeSniffer
run: docker-compose exec -u www-data -T www phpcs /opt/drupal/web/profiles/farm