Automatic update #2508
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 | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: Install and start Stonehenge | |
run: | | |
git clone -b 5.x https://github.com/druidfi/stonehenge.git ~/stonehenge | |
cd ~/stonehenge && make up | |
# This must be done after we start Stonehenge. | |
- name: Setup Docker compose environment variables | |
run: | | |
echo "COMPOSE_FILE=compose.yaml:compose.ci.yaml" >> $GITHUB_ENV | |
echo "COMPOSE_PROFILES=" >> $GITHUB_ENV | |
- name: Start project | |
run: make up | |
- name: Build project | |
run: docker compose exec app bash -c "composer install --no-interaction" | |
- name: Scan security updates | |
run: docker compose exec app bash -c "composer audit" | |
- name: Check that subtheme is not built with dev mode | |
run: docker compose exec app bash -c "if grep -q 'sourceMappingURL=' -R public/themes/custom/hdbt_subtheme/dist/css; then exit 1; fi" | |
- name: Run PHPCS | |
run: | | |
docker compose exec app bash -c "vendor/bin/phpcs public/modules/custom/" | |
docker compose exec app bash -c "vendor/bin/phpcs public/themes/custom/" | |
- name: Run phpstan | |
run: docker compose exec app bash -c "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: | | |
docker compose exec app bash -c "mysql --user=drupal --password=drupal --database=drupal --host=db --port=3306 -A < latest.sql" | |
docker compose exec app bash -c "drush deploy" | |
- name: Run PHPUnit tests | |
run: | | |
docker compose exec app bash -c "mkdir -p /app/results" | |
if [ -d "tests/" ]; then | |
docker compose exec app bash -c "composer test-php tests/" | |
fi | |
docker compose exec app bash -c "composer test-php public/modules/custom" | |
- name: Export logs | |
if: always() | |
run: docker compose logs app > results/service.log | |
- name: Create an artifact from test report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: results | |
path: results/ | |
retention-days: 1 |