Convert @var to assertInstanceOf in tests #6
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: | |
branches: | |
tags: | |
pull_request: | |
jobs: | |
php-cs-fixer: | |
runs-on: ubuntu-latest | |
env: | |
PHP_CS_FIXER_VERSION: v3.6.0 | |
strategy: | |
matrix: | |
php: | |
- '8.1' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: curl,mbstring | |
tools: php-cs-fixer:${{ env.PHP_CS_FIXER_VERSION }} | |
coverage: none | |
- name: Run PHP-CS-Fixer Fix, version ${{ env.PHP_CS_FIXER_VERSION }} | |
run: php-cs-fixer fix --dry-run --diff --ansi | |
build: | |
runs-on: ${{ matrix.os }} | |
name: PHP v${{ matrix.php }} with MongoDB ${{ matrix.mongodb }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
mongodb: | |
- '4.4' | |
- '5.0' | |
- '6.0' | |
- '7.0' | |
php: | |
- '8.1' | |
- '8.2' | |
services: | |
mysql: | |
image: mysql:8.0 | |
ports: | |
- 3307:3306 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' | |
MYSQL_DATABASE: 'unittest' | |
MYSQL_ROOT_PASSWORD: | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create MongoDB Replica Set | |
run: | | |
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=unittest --detach mongo:${{ matrix.mongodb }} mongod --replSet rs --setParameter transactionLifetimeLimitSeconds=5 | |
if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi | |
until docker exec --tty mongodb $MONGOSH_BIN 127.0.0.1:27017 --eval "db.runCommand({ ping: 1 })"; do | |
sleep 1 | |
done | |
sudo docker exec --tty mongodb $MONGOSH_BIN 127.0.0.1:27017 --eval "rs.initiate({\"_id\":\"rs\",\"members\":[{\"_id\":0,\"host\":\"127.0.0.1:27017\" }]})" | |
- name: Show MongoDB server status | |
run: | | |
if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi | |
docker exec --tty mongodb $MONGOSH_BIN 127.0.0.1:27017 --eval "db.runCommand({ serverStatus: 1 })" | |
- name: "Installing php" | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: curl,mbstring,xdebug | |
coverage: xdebug | |
tools: composer | |
- name: Show PHP version | |
run: php -v && composer -V | |
- name: Show Docker version | |
run: if [[ "$DEBUG" == "true" ]]; then docker version && env; fi | |
env: | |
DEBUG: ${{secrets.DEBUG}} | |
- name: Download Composer cache dependencies from cache | |
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: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ matrix.os }}-composer- | |
- name: Install dependencies | |
run: | | |
composer install --no-interaction | |
- name: Run tests | |
run: | | |
./vendor/bin/phpunit --coverage-clover coverage.xml | |
env: | |
MONGODB_URI: 'mongodb://127.0.0.1/?replicaSet=rs' | |
MYSQL_HOST: 0.0.0.0 | |
MYSQL_PORT: 3307 | |
- uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: false |