Skip to content

Commit d373af7

Browse files
committed
Change PHP GitHub Action to use docker container for entire PHPUnit job.
1 parent a404863 commit d373af7

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

.github/workflows/php.yml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ jobs:
6565
working-directory: "solid"
6666
# 02.test.php.test-unit.yml
6767
php-unittest:
68+
container:
69+
image: ghcr.io/${{ github.repository }}:main-${{ matrix.nextcloud_version }}
70+
env:
71+
NEXTCLOUD_PATH: /usr/src/nextcloud/
72+
NEXTCLOUD_UPDATE: 1
73+
XDEBUG_MODE: coverage
74+
volumes:
75+
- /usr/bin/composer:/usr/bin/composer
6876
name: PHP Unit Tests
6977
needs:
7078
- lint-php-syntax
@@ -78,27 +86,24 @@ jobs:
7886
- 29
7987
- 30
8088
steps:
81-
- uses: actions/checkout@v4
82-
- uses: shivammathur/setup-php@v2
83-
with:
84-
ini-values: error_reporting=E_ALL, display_errors=On
85-
php-version: 8.3
89+
- uses: actions/checkout@v5
90+
- name: Setup Test Environment
91+
run: |
92+
git config --global --add safe.directory "${NEXTCLOUD_PATH}/apps"
93+
/entrypoint.sh "echo"
94+
bash "${GITHUB_WORKSPACE}/init.sh"
95+
rm -r "${NEXTCLOUD_PATH}/apps/solid/"
96+
cp --archive --verbose "${GITHUB_WORKSPACE}/." "${NEXTCLOUD_PATH}/apps/"
8697
- name: Install and Cache Composer dependencies
87-
uses: "ramsey/composer-install@v2"
98+
uses: ramsey/composer-install@v3
8899
with:
89-
working-directory: "solid"
100+
working-directory: /usr/src/nextcloud/apps/solid
90101
env:
91102
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
92-
- run: |
93-
docker run \
94-
--env 'XDEBUG_MODE=coverage' \
95-
--rm \
96-
--volume="./solid:/var/www/html/apps/solid" \
97-
ghcr.io/${{ github.repository }}:main-${{ matrix.nextcloud_version }} \
98-
bash -c 'NEXTCLOUD_UPDATE=1 /entrypoint.sh "echo" \
99-
&& sudo -u www-data bash /init.sh \
100-
&& cd /var/www/html/apps/solid \
101-
&& bin/phpunit --configuration phpunit.xml'
103+
- name: Run PHPUnit
104+
run: bin/phpunit --configuration phpunit.xml
105+
with:
106+
working-directory: /usr/src/nextcloud/apps/solid
102107

103108
# 03.quality.php.scan.dependencies-vulnerabilities.yml
104109
scan-dependencies-vulnerabilities:

0 commit comments

Comments
 (0)