Upgraded minimum Yii version to 2.0.49 for several bug fixes. Compose… #186
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: build | |
on: [push, pull_request] | |
env: | |
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi" | |
XDEBUG_MODE: coverage, develop | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
codeception: | |
name: PHP ${{ matrix.php }} on ${{ matrix.os }} with ${{ matrix.db }} | |
runs-on: ${{ matrix.os }} | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: Yii2Oauth2ServerTest | |
MYSQL_USER: Yii2Oauth2ServerTest | |
MYSQL_PASSWORD: password | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: Yii2Oauth2ServerTest | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: Yii2Oauth2ServerTest | |
ports: | |
- 5432/tcp | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
php: ['7.4', '8.0', '8.1'] | |
db: ['mysql', 'postgres'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl | |
extensions: curl, dom, imagick, intl, mbstring, mcrypt, memcached, mysql, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, sqlite | |
ini-values: date.timezone='UTC', session.save_path="${{ runner.temp }}" | |
- 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@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer update $DEFAULT_COMPOSER_FLAGS | |
- name: Set private and public key permissions | |
id: set-private-and-public-key-permissions | |
run: chmod 660 tests/_config/keys/private.key tests/_config/keys/public.key | |
- name: Codeception tests | |
run: php vendor/bin/codecept run --steps --colors --coverage-xml | |
env: | |
# WARNING! | |
# These variables are provided for testing use only. NEVER use them for other purposes! | |
YII2_OAUTH2_SERVER_PRIVATE_KEY_PASSPHRASE: secret | |
YII2_OAUTH2_SERVER_CODES_ENCRYPTION_KEY: def00000761b6fce5b2c1721c37602e82effb785154c3bb0db93bfb3f413012bd85d46461e28f156a3a5afab910a64d5b2665276d45f24b1085d90e12ab3d38ee47b4337 | |
YII2_OAUTH2_SERVER_STORAGE_ENCRYPTION_KEYS: > | |
{ | |
"2021-01-01": "def00000cb36fd6ed6641e0ad70805b28da86192765eb73daae7306acc537ca5e9678db80e92dbfcb489debbac0ed96139e6ff210fc0281078e99c1420d2d18e2c7388ac", | |
"2022-01-01": "def00000c8fc3b1b8d017afc6a645f94e6d2f5fc9d71e8b3eb26e5b2de6ef23232dd19446bbeef26fbd51dd2fd4cd5641e68db28ec76f8460bb3f33aaab3cff7b9fcfe62" | |
} | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} | |
MYSQL_DB_NAME: Yii2Oauth2ServerTest | |
MYSQL_USER_NAME: Yii2Oauth2ServerTest | |
MYSQL_USER_PASSWORD: password | |
POSTGRES_HOST: 127.0.0.1 | |
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }} | |
POSTGRES_USER: Yii2Oauth2ServerTest | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: Yii2Oauth2ServerTest | |
YII2_OAUTH2_SERVER_TEST_DB_DRIVER: ${{ matrix.db }} | |
# - name: Upload Scrutinizer coverage | |
# uses: sudo-bot/action-scrutinizer@latest | |
# with: | |
# cli-args: "--format=php-clover tests/_output/coverage.xml" | |
# continue-on-error: true # if is fork | |
- name: Code coverage (phar) # ToDo: PHP 8 compatibility (https://github.com/scrutinizer-ci/ocular/issues/51) | |
run: | | |
wget https://scrutinizer-ci.com/ocular.phar | |
php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml | |
continue-on-error: true # if is fork |