Automatic update #2855
Workflow file for this run
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-web:8.3 | |
options: --hostname app --user 1001 | |
services: | |
db: | |
image: mysql:8 | |
env: | |
MYSQL_USER: drupal | |
MYSQL_PASSWORD: drupal | |
MYSQL_DATABASE: drupal | |
MYSQL_ROOT_PASSWORD: drupal | |
ports: | |
- 3306:3306 | |
steps: | |
- uses: actions/checkout@v4 | |
# Actions worker overrides the default entrypoint with "tail -f /dev/null", so | |
# we have to start services manually. | |
- name: Start services | |
env: | |
WEBROOT: ${{ github.workspace }}/public | |
run: entrypoint & | |
- name: Set browsertest output folder | |
run: | | |
echo "BROWSERTEST_OUTPUT_DIRECTORY=$GITHUB_WORKSPACE/public/sites/simpletest" >> $GITHUB_ENV | |
- name: Make sure configuration was exported in correct language (en or und) | |
run: | | |
OUTPUT=$(grep -oP '^langcode: \b(?!(?:en|und)\b)\w+' conf -R || true) | |
if [ ! -z "$OUTPUT" ]; then | |
echo "Found configuration that does not match the pattern 'langcode: (en|und)':" >> $GITHUB_STEP_SUMMARY | |
echo "$OUTPUT" >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
fi | |
- name: Build project | |
run: composer install --no-interaction | |
- name: Scan security updates | |
run: composer audit | |
- 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/ | |
vendor/bin/phpcs public/themes/custom/ | |
- name: Run phpstan | |
run: vendor/bin/phpstan analyze | |
- 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: | | |
for i in {1..5}; do RESPONSE_CODE=$(curl -k -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 | |
if [ -d "tests/" ]; then composer test-php tests/; else echo "No DTT tests found. Ignoring..."; fi | |
- name: Create an artifact from test report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: results | |
path: ${{ env.BROWSERTEST_OUTPUT_DIRECTORY }} | |
retention-days: 1 |