Simple test added for coverage generation and testing #1
Workflow file for this run
This file contains 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: "PHP Tests" | |
on: | |
push: | |
branches: [ $default-branch ] | |
paths: | |
- ".github/workflows/php-push.yml" | |
- "**/*.php" | |
- "composer.lock" | |
- "composer.json" | |
pull_request: | |
paths: | |
- ".github/workflows/php-push.yml" | |
- "**/*.php" | |
- "composer.lock" | |
- "composer.json" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-phptest: | |
runs-on: ubuntu-22.04 | |
services: | |
postgres: | |
image: postgres:16.2 | |
env: | |
POSTGRES_USER: 'root' | |
POSTGRES_PASSWORD: 'root' | |
POSTGRES_DB: 'recipebox_test' | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 5s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
extensions: imagick, mbstring, sqlite, pdo-sqlite, :php-psr | |
coverage: pcov | |
ini-values: memory_limit=-1 | |
- name: Validate composer.json and composer.lock | |
run: composer validate --strict | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v4 | |
if: ${{ !env.ACT }} | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: PHP Lint | |
run: composer run pint | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
if: ${{ !env.ACT }} | |
with: | |
commit_message: Apply pint changes | |
- name: Set app key | |
run: APP_ENV=testing php artisan key:generate | |
- name: Tests | |
run: php artisan test -p --coverage-clover=clover.xml | |
env: | |
DB_HOST: localhost | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./clover.xml | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: true |