feat: Adds integration test execution to the pipeline. #45
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: CI | |
on: | |
push: | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
auto-review: | |
name: Auto review | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use PHP 8.2 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
- name: Install dependencies | |
run: composer update --no-progress --optimize-autoloader | |
- name: Run review | |
run: composer review | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
services: | |
cheap-delivery-adm: | |
image: mysql:8.1 | |
env: | |
MYSQL_DATABASE: "cheap_delivery_adm_test" | |
MYSQL_ROOT_PASSWORD: "root" | |
ports: | |
- 3307:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Start database container | |
run: docker run --name cheap-delivery-adm -d mysql:8.1 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use PHP 8.2 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
extensions: pdo, pdo_mysql | |
- name: Install dependencies | |
run: composer update --no-progress --optimize-autoloader | |
- name: Connect to Docker network | |
run: docker network create cheap-delivery_default || true | |
- name: Connect database container to network | |
run: docker network connect cheap-delivery_default cheap-delivery-adm || true | |
- name: Run database migrations | |
run: | | |
docker run --rm -v ${PWD}/db/mysql/migrations:/flyway/sql \ | |
--env-file=config/local.env -e FLYWAY_URL=jdbc:mysql://127.0.0.1:3306?useUnicode=yes&characterEncoding=UTF-8 \ | |
flyway/flyway:10.8.1 \ | |
-locations=filesystem:/flyway/sql -schemas=cheap_delivery_adm_test migrate | |
- name: Run tests | |
env: | |
XDEBUG_MODE: coverage | |
run: composer test |