Merge pull request #699 from City-of-Helsinki/update-configuration #2074
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
on: | |
pull_request: | |
push: | |
branches: ['main', 'dev'] | |
name: CI | |
env: | |
SYMFONY_DEPRECATIONS_HELPER: disabled | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/city-of-helsinki/drupal-php-docker:8.2-alpine | |
services: | |
db: | |
image: mariadb | |
env: | |
MYSQL_USER: drupal | |
MYSQL_PASSWORD: drupal | |
MYSQL_DATABASE: drupal | |
MYSQL_ROOT_PASSWORD: drupal | |
ports: | |
- 3306:3306 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Build project | |
run: composer install --no-interaction | |
- name: Scan security updates | |
run: drush pm:security | |
- name: Check that subtheme is not built with dev mode | |
run: if grep -q 'sourceMappingURL=' -R public/themes/custom/hdbt_subtheme/dist/css; then exit 1; fi | |
- name: Run PHPCS | |
run: | | |
vendor/bin/phpcs public/modules/custom/ --ignore="*.js,*.css" --extensions=php,module,install --standard=Drupal | |
vendor/bin/phpcs public/themes/custom/ --ignore="*.js,*.css" --extensions=php,theme --standard=Drupal | |
- name: Download latest dump | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh run download -n latest.sql | |
- name: Install Drupal | |
run: | | |
mysql --user=drupal --password=drupal --database=drupal --host=db --port=3306 -A < latest.sql | |
drush deploy | |
- name: Start services | |
run: | | |
drush runserver $SIMPLETEST_BASE_URL > /dev/null 2>&1 & | |
chromedriver --port=4444 > /dev/null 2>&1 & | |
# Chromium browser is required to run 'functional-javascript' and | |
# 'existing-site-javascript' tests. | |
chromium-browser --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 & | |
# Wait for drush server to start. | |
for i in {1..5}; do RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$SIMPLETEST_BASE_URL" || true); if [ "$RESPONSE_CODE" -gt "301" ] || [ "$RESPONSE_CODE" -lt "200" ]; then sleep 2; fi; done | |
- name: Run PHPUnit tests | |
run: | | |
composer test-php public/modules/custom | |
[ -d "tests/" ] && composer test-php tests/ || echo "No DTT tests found. Ignoring..." |