Skip to content

#10 - add tests and more examples #14

#10 - add tests and more examples

#10 - add tests and more examples #14

Workflow file for this run

name: Test&lint PHP codebase
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test-and-lint-php:
name: Test&lint PHP codebase
runs-on: ubuntu-20.04
services:
pgsql:
image: postgres:15
env:
POSTGRES_DB: slim
POSTGRES_USER: slim
POSTGRES_PASSWORD: password
PGPASSWORD: password
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-composer-dependencies-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-dependencies
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, intl
coverage: none
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-suggest
- name: Run PHP linter
run: composer cs:check
- name: Run PHPSTAN
run: composer phpstan
- name: Execute tests
run: |
php vendor/bin/doctrine migrations:migrate
composer test
env:
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: slim
DB_USER: slim
DB_PASSWORD: password
- name: Execute Architecture tests
run: |
composer test:architecture
- name: Commit Code Coverage Image to Repo
uses: EndBug/add-and-commit@v5
with:
author_name: Aleksander Kowalski
author_email: mrhdolek14@gmail.com
message: "#3 - Add code coverage image"
add: "resources/code-coverage.png"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}