Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Jan 28, 2024
1 parent 28e94fc commit a5c6059
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 57 deletions.
6 changes: 0 additions & 6 deletions .docker/php81.Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions .docker/php82.Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions .docker/php83.Dockerfile

This file was deleted.

4 changes: 4 additions & 0 deletions .docker/xdebug.ci.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
zend_extension=xdebug

[xdebug]
xdebug.mode=coverage
5 changes: 5 additions & 0 deletions .docker/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
zend_extension=xdebug

[xdebug]
xdebug.mode=coverage,debug,develop
xdebug.client_host=host.docker.internal
19 changes: 10 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/.docker export-ignore
/.github export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
docker-compose.yml export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
/.docker export-ignore
/.github export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
docker-compose.ci.yml export-ignore
docker-compose.yml export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
38 changes: 20 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,28 @@ jobs:
include:
- php: 8.3
release: stable
coverage: xdebug
coverage: true

steps:
- uses: actions/checkout@v3
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
fetch-depth: 2
- uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: bcmath, ctype, json, mbstring, openssl, pdo, pdo_sqlite, tokenizer, xml
coverage: ${{ matrix.coverage }}
- run: composer update --no-interaction --no-progress --prefer-dist --prefer-${{ matrix.release }}
- run: |
PHPUNIT_FLAGS=$([ "${{ matrix.coverage }}" == "xdebug" ] && echo "--coverage-clover=coverage.xml" || echo "")
vendor/bin/phpunit $PHPUNIT_FLAGS
- uses: codecov/codecov-action@v3
path: ~/.cache/composer/files
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Check out code
uses: actions/checkout@v4
if: steps.pull.outcome != 'success'
- name: Install dependencies
run: |
docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm php${{ matrix.php }} \
composer update --no-interaction --no-progress --prefer-dist --prefer-${{ matrix.release }}
- name: Run tests
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm php${{ matrix.php }} \
vendor/bin/phpunit ${{ env.COVERAGE }}
env:
COVERAGE: ${{ matrix.coverage && '--coverage-clover=coverage.xml' || '' }}
- name: Upload code coverage
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: matrix.coverage == 'xdebug' && env.CODECOV_TOKEN
if: matrix.coverage && env.CODECOV_TOKEN
22 changes: 22 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3.8'

services:
php8.1:
image: ghcr.io/staudenmeir/php:8.1
working_dir: /var/www/html
volumes:
- .:/var/www/html:delegated
- ~/.cache/composer/files:/root/.composer/cache/files
php8.2:
image: ghcr.io/staudenmeir/php:8.2
working_dir: /var/www/html
volumes:
- .:/var/www/html:delegated
- ~/.cache/composer/files:/root/.composer/cache/files
php8.3:
image: ghcr.io/staudenmeir/php:8.3
working_dir: /var/www/html
volumes:
- .:/var/www/html:delegated
- .docker/xdebug.ci.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- ~/.cache/composer/files:/root/.composer/cache/files
21 changes: 9 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
version: '3.8'

services:
php81:
build:
context: .
dockerfile: .docker/php81.Dockerfile
php8.1:
image: ghcr.io/staudenmeir/php:8.1
working_dir: /var/www/html
volumes:
- .:/var/www/html:delegated
php82:
build:
context: .
dockerfile: .docker/php82.Dockerfile
- .docker/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
php8.2:
image: ghcr.io/staudenmeir/php:8.2
working_dir: /var/www/html
volumes:
- .:/var/www/html:delegated
php83:
build:
context: .
dockerfile: .docker/php83.Dockerfile
- .docker/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
php8.3:
image: ghcr.io/staudenmeir/php:8.3
working_dir: /var/www/html
volumes:
- .:/var/www/html:delegated
- .docker/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

0 comments on commit a5c6059

Please sign in to comment.