chore(coverage): add docker cache #8
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'coverage-report' | |
on: | |
push: | |
branches: | |
- main | |
- chore/code-coverage # remove before merge to main | |
permissions: | |
contents: write | |
jobs: | |
coverage-report: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
coverage: none | |
tools: composer:v2 | |
extensions: xdebug | |
- name: Install Dependencies | |
run: composer install -q --profile --ignore-platform-reqs --no-interaction --no-ansi --no-scripts --no-suggest --prefer-dist | |
- uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: "network=host" | |
- name: Cache Docker Compose | |
id: cache-docker-compose | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.docker-compose-cache | |
key: ${{ runner.os }}-docker-compose-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-docker-compose- | |
- uses: KengoTODA/actions-setup-docker-compose@4677f0d86d41e623c9c6e11e1d910976da297bc0 | |
with: | |
version: '2.14.2' | |
- name: Set Permissions for Coverage Directory | |
run: | | |
mkdir -p cov/json cov/xml cov/html | |
chmod -R 777 cov | |
- name: "Create Empty env File for Docker" | |
run: touch .env | |
- name: Load Docker Compose Cache | |
if: steps.cache-docker-compose.outputs.cache-hit != 'true' | |
run: | | |
echo "Restoring Docker Compose cache..." | |
docker-compose up --no-start | |
- name: PHPUnit | |
run: docker-compose run phpunit --coverage-xml cov/xml --coverage-html cov/html --coverage-clover=cov/xml/clover.xml | |
- name: "Parse Coverage" | |
run: "php ./coverage.php" | |
- name: Create Coverage Badges | |
uses: jaywcjlove/coverage-badges-cli@e07f25709cd25486855c1ba1b26da53576ff3620 | |
with: | |
source: cov/json/index.json | |
output: cov/html/coverage.svg | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@8817a56e5bfec6e2b08345c81f4d422db53a2cdc | |
with: | |
branch: gh-pages | |
folder: cov/html |