Skip to content

ci

ci #91

Workflow file for this run

name: CI
on: [ push, pull_request ]
env:
REGISTRY: ghcr.io
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 8.3 ]
release: [ stable ]
include:
- php: 8.3
release: stable
coverage: xdebug
steps:
- uses: actions/checkout@v4
- run: echo ${{ hashFiles(format('.docker/php{0}.Dockerfile', matrix.php)) }}
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
docker pull ${{ env.REGISTRY }}/${{ github.actor }}/belongs-to-through/php${{ matrix.php }}:${{ env.TAG }}
continue-on-error: true
env:
TAG: ${{ hashFiles(format('.docker/php{0}.Dockerfile', matrix.php)) }}
id: pull
- run: |
docker compose build php${{ matrix.php }}
docker tag belongs-to-through-php${{ matrix.php }} ${{ env.REGISTRY }}/${{ github.actor }}/belongs-to-through/php${{ matrix.php }}:${{ env.TAG }}
docker push ${{ env.REGISTRY }}/${{ github.actor }}/belongs-to-through/php${{ matrix.php }}:${{ env.TAG }}
env:
TAG: ${{ hashFiles(format('.docker/php{0}.Dockerfile', matrix.php)) }}
if: steps.pull.outcome != 'success'
- uses: actions/cache@v3
with:
path: ~/.cache/composer/files
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- run: docker compose -f docker-compose.ci.yml run --rm php${{ matrix.php }} composer update --no-interaction --no-progress --prefer-dist --prefer-${{ matrix.release }}
env:
TAG: ${{ hashFiles(format('.docker/php{0}.Dockerfile', matrix.php)) }}
- run: |
PHPUNIT_FLAGS=$([ "${{ matrix.coverage }}" == "xdebug" ] && echo "--coverage-clover=coverage.xml" || echo "")
docker compose -f docker-compose.ci.yml run --rm php${{ matrix.php }} vendor/bin/phpunit $PHPUNIT_FLAGS
env:
TAG: ${{ hashFiles(format('.docker/php{0}.Dockerfile', matrix.php)) }}
- uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: matrix.coverage == 'xdebug' && env.CODECOV_TOKEN