-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (117 loc) · 3.77 KB
/
Copy pathdrupal-module.yml
File metadata and controls
132 lines (117 loc) · 3.77 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Drupal Module
on:
pull_request:
paths:
- "**/*.php"
- "**/*.yml"
- "composer.json"
- "tests/**"
- ".github/workflows/drupal-module.yml"
push:
paths:
- "**/*.php"
- "**/*.yml"
- "composer.json"
- "tests/**"
- ".github/workflows/drupal-module.yml"
jobs:
phpunit:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
include:
- drupal: "^10"
php: "8.2"
experimental: false
coverage: false
- drupal: "^11"
php: "8.3"
experimental: false
coverage: true
- drupal: "^11"
php: "8.4"
experimental: false
coverage: false
- drupal: "^11"
php: "8.5"
experimental: true
coverage: false
env:
SIMPLETEST_BASE_URL: "http://127.0.0.1:8888"
SIMPLETEST_DB: "sqlite://localhost/sites/default/files/db.sqlite"
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
tools: composer:v2
extensions: gd
coverage: pcov
- name: Create Drupal project
run: |
composer config --global policy.advisories.block false
composer create-project drupal/recommended-project:${{ matrix.drupal }} drupal --no-interaction --prefer-dist
- name: Install module from this repo
run: |
mkdir -p drupal/web/modules/contrib/jsonapi_frontend
rsync -a --delete \
--exclude ".git" \
--exclude "drupal" \
--exclude ".github" \
./ drupal/web/modules/contrib/jsonapi_frontend/
- name: Install Drupal test dependencies
run: |
cd drupal
composer require --dev drupal/core-dev:${{ matrix.drupal }} --no-interaction --prefer-dist -W
- name: Prepare test directories
run: |
mkdir -p drupal/web/sites/default/files
mkdir -p drupal/web/sites/simpletest/browser_output
chmod -R 777 drupal/web/sites/default/files
chmod -R 777 drupal/web/sites/simpletest/browser_output
- name: Start test webserver
run: |
cd drupal/web
php -S 127.0.0.1:8888 .ht.router.php >/tmp/php-server.log 2>&1 &
echo $! > /tmp/php-server.pid
- name: Run PHPUnit
if: ${{ !matrix.coverage }}
run: |
cd drupal/web
../vendor/bin/phpunit -c core modules/contrib/jsonapi_frontend/tests
- name: Run PHPUnit (coverage)
if: ${{ matrix.coverage }}
run: |
cd drupal/web
../vendor/bin/phpunit -c core modules/contrib/jsonapi_frontend/tests \
--coverage-clover "$GITHUB_WORKSPACE/coverage.xml" \
--coverage-filter modules/contrib/jsonapi_frontend
- name: Upload coverage artifact
if: ${{ matrix.coverage }}
uses: actions/upload-artifact@v7
with:
name: coverage-jsonapi_frontend
path: coverage.xml
if-no-files-found: error
- name: Upload coverage to Codecov
if: ${{ matrix.coverage }}
continue-on-error: true
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad
with:
use_oidc: true
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: phpunit,drupal
fail_ci_if_error: false
verbose: true
- name: Stop test webserver
if: always()
run: |
if [ -f /tmp/php-server.pid ]; then
kill "$(cat /tmp/php-server.pid)" || true
fi