wallabag/.github/workflows/continuous-integration.yml
Jeremy Benoist 0ac8089eee
CI workaround for PHP < 7.4 & MySQL 8
The error on PHP 7.2 & 7.3 is:

> PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

See:
- https://stackoverflow.com/q/53066962/569101
- https://stackoverflow.com/q/52364415/569101
- https://stackoverflow.com/q/51489616/569101
- https://stackoverflow.com/q/50026939/569101

Also upgrade `actions/checkout` v3
2022-04-11 22:11:22 +02:00

93 lines
2.6 KiB
YAML

name: "CI"
on:
pull_request:
push:
branches:
- master
- 2.*
env:
PGPASSWORD: wallabagrocks
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
phpunit:
name: "PHP ${{ matrix.php }} using ${{ matrix.database }}"
runs-on: "ubuntu-20.04"
services:
rabbitmq:
image: rabbitmq:3-alpine
ports:
- 5672:5672
redis:
image: redis:6-alpine
ports:
- 6379:6379
strategy:
fail-fast: false
matrix:
php:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
database:
- "sqlite"
- "mysql"
- "pgsql"
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php }}"
coverage: none
tools: pecl, composer:2.2
extensions: json, pdo, pdo_mysql, pdo_sqlite, pdo_pgsql, curl, imagick, pgsql, gd, tidy
ini-values: "date.timezone=Europe/Paris"
- name: "Install MySQL (for PHP < 7.4)"
# there is an issue with PHP < 7.4 and MySQL 8 with `caching_sha2_password`
if: "${{ matrix.database == 'mysql' && (matrix.php == '7.2' || matrix.php == '7.3') }}"
uses: shogo82148/actions-setup-mysql@v1
with:
root-password: root
mysql-version: '5.7'
- name: "Install MySQL (for PHP >= 7.4)"
if: "${{ matrix.database == 'mysql' && matrix.php != '7.2' && matrix.php != '7.3' }}"
run: sudo systemctl start mysql.service
- name: "Setup MySQL"
if: "${{ matrix.database == 'mysql' }}"
run: sudo mysql -u root -proot -h 127.0.0.1 -e "CREATE DATABASE wallabag_test"
- name: "Setup PostgreSQL"
if: "${{ matrix.database == 'pgsql' }}"
run: |
sudo systemctl start postgresql
sudo -u postgres psql -d template1 -c "CREATE USER wallabag WITH PASSWORD 'wallabagrocks' CREATEDB"
createdb -h localhost -p 5432 -U wallabag wallabag_test
pg_isready -d wallabag_test -h localhost -p 5432 -U wallabag
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--optimize-autoloader --prefer-dist"
- name: "Prepare database"
run: "make prepare DB=${{ matrix.database }}"
- name: "Prepare fixtures"
run: "make fixtures"
- name: "Run PHPUnit"
run: "php bin/simple-phpunit -v"