Skip to content

ci

ci #99

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 ] # TODO
release: [ stable, lowest ]
include:
- php: 8.3
release: stable
coverage: xdebug
steps:
- uses: actions/checkout@v4
- run: echo "IMAGE=${{ env.REGISTRY }}/${{ github.repository }}/php${{ matrix.php }}" >> $GITHUB_ENV
- run: echo "TAG=${{ hashFiles(format('.docker/php{0}.Dockerfile', matrix.php)) }}" >> $GITHUB_ENV
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
docker pull ${{ env.IMAGE }}:${{ env.TAG }}
continue-on-error: true
id: pull
- run: |
docker compose build php${{ matrix.php }}
docker tag ${{ github.event.repository.name }}-php${{ matrix.php }} ${{ env.IMAGE }}:${{ env.TAG }}
docker push ${{ env.IMAGE }}:${{ env.TAG }}
if: steps.pull.outcome != 'success'
- uses: actions/cache@v4
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 }}
- run: docker compose -f docker-compose.ci.yml run --rm php${{ matrix.php }} vendor/bin/phpunit ${{ env.COVERAGE }}
env:
COVERAGE: ${{ matrix.coverage == 'xdebug' && '--coverage-clover=coverage.xml' || '' }}
- uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: matrix.coverage == 'xdebug' && env.CODECOV_TOKEN