Skip to content

Remove unused imports #166

Remove unused imports

Remove unused imports #166

Workflow file for this run

# GitHub Actions workflow for Continuos Integration tests
name: CI
on: [push, pull_request]
env:
COMPOSER_ARGS: '--no-interaction --no-progress --prefer-dist --optimize-autoloader'
DB_NAME: p3_db_test
DB_USER: p3_db_user
DB_PASS: secret123
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
operating-systems: [ubuntu-latest]
php-versions: ['7.4', '8.0', '8.1', '8.2']
composer-deps: ['lowest', 'latest']
runs-on: ${{ matrix.operating-systems }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_HOST: '172.*.*.*' # grant root access inside docker network
MYSQL_ROOT_PASSWORD: secret123
MYSQL_HOST: localhost # The default host name used by the mysql command-line client.
MYSQL_DATABASE: ${{ env.DB_NAME }}
MYSQL_USER: ${{ env.DB_USER }}
MYSQL_PASSWORD: ${{ env.DB_PASS }}
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:9-alpine
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: ${{ env.DB_NAME }}
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASS }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout the repository
uses: actions/checkout@v2
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer dependencies
id: composer-install
run: composer install ${{ env.COMPOSER_ARGS }}
- name: Update Composer dependencies to lowest stable
id: composer-update-lowest
if: ${{ matrix.composer-deps == 'lowest' }}
run: composer update ${{ env.COMPOSER_ARGS }} --prefer-lowest --prefer-stable
- name: Update Composer dependencies to latest
id: composer-update-latest
if: ${{ matrix.composer-deps == 'latest' }}
run: composer update ${{ env.COMPOSER_ARGS }}
- name: Code Style check (phpcs)
id: phpcs
run: composer cs
# - name: Static Analysis (phpstan)
# id: phpstan
# run: composer stan
# - name: Test MySQL connection
# run: mysql --host=localhost --protocol=TCP --port=3306 --user=p3_db_user --password=secret123 -e "SHOW DATABASES"
- name: Test (phpunit)
id: phpunit
env:
TEST_P3_DB_MYSQL: true
TEST_P3_DB_MYSQL_HOST: 127.0.0.1
TEST_P3_DB_MYSQL_PORT: 3306
TEST_P3_DB_MYSQL_DBNAME: ${{ env.DB_NAME }}
TEST_P3_DB_MYSQL_CHARSET: utf8
TEST_P3_DB_MYSQL_USERNAME: ${{ env.DB_USER }}
TEST_P3_DB_MYSQL_PASSWD: ${{ env.DB_PASS }}
run: composer test