-
Notifications
You must be signed in to change notification settings - Fork 8
82 lines (66 loc) · 2.72 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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