Move tests to GitHub Actions

This commit is contained in:
Fran Moreno
2020-11-29 14:47:09 +01:00
committed by Grégoire Paris
parent 9f77e1a7cf
commit 94372f512a
4 changed files with 125 additions and 65 deletions

2
.gitattributes vendored
View File

@@ -1,9 +1,9 @@
* text=auto
/Tests export-ignore
/.github export-ignore
.doctrine-project.json export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
phpcs.xml.dist export-ignore
phpunit.xml.dist export-ignore

View File

@@ -0,0 +1,123 @@
name: "Continuous Integration"
on:
pull_request:
branches:
- "*.x"
- "master"
push:
env:
fail-fast: true
jobs:
phpunit:
name: "PHPUnit"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os:
- "ubuntu-20.04"
php-version:
- "7.2"
- "7.3"
- "7.4"
symfony-version:
- "4.4.x"
- "5.1.x"
driver-version:
- "stable"
deps:
- "normal"
include:
- deps: "low"
os: "ubuntu-20.04"
php-version: "7.2"
driver-version: "1.5.0"
symfony-version: "4.4.*"
services:
mongodb:
image: "mongo"
ports:
- "27017:27017"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: "mongodb-${{ matrix.driver-version }}"
key: "extcache-v1"
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
tools: "pecl"
extensions: "mongodb-${{ matrix.driver-version }}"
coverage: "xdebug"
ini-values: "zend.assertions=1"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
- name: "Install Symfony"
run: "composer require symfony/symfony:${{ matrix.symfony-version }} --no-update"
- name: "Install dependencies with composer"
run: "composer update --no-interaction --no-progress --prefer-stable"
if: "${{ matrix.deps == 'normal' }}"
- name: "Install lowest possible dependencies with composer"
run: "composer update --no-interaction --no-progress --prefer-dist --prefer-stable --prefer-lowest"
if: "${{ matrix.deps == 'low' }}"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "phpunit-${{ matrix.php-version }}.coverage"
path: "coverage.xml"
upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-20.04"
needs:
- "phpunit"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2
- name: "Download coverage files"
uses: "actions/download-artifact@v2"
with:
path: "reports"
- name: "Upload to Codecov"
uses: "codecov/codecov-action@v1"
with:
directory: reports

View File

@@ -1,63 +0,0 @@
dist: xenial
language: php
sudo: false
cache:
directories:
- $HOME/.composer/cache
php:
- 7.2
- 7.3
- 7.4
services: mongodb
env:
global:
- DRIVER_VERSION="stable"
- COMPOSER_FLAGS=" -n --prefer-dist --prefer-stable"
- COMPOSER_MEMORY_LIMIT=-1
before_install:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
- composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
install:
- composer self-update
- pecl install -f mongodb-${DRIVER_VERSION}
- if [[ -z ${REQUIRE_SYMFONY_MESSENGER} ]]; then composer require --dev symfony/messenger --no-update; fi
- composer update ${COMPOSER_FLAGS}
script:
- ./vendor/bin/phpunit ${PHPUNIT_FLAGS}
jobs:
include:
# Tests the lowest set of dependencies
- php: 7.2
env: LOWEST DRIVER_VERSION="1.5.0" SYMFONY_DEPRECATIONS_HELPER=weak COMPOSER_FLAGS=" -n --prefer-lowest --prefer-stable --prefer-dist"
# Test against latest Symfony 4.3 stable
- php: 7.3
env: SYMFONY_REQUIRE="4.3.*" REQUIRE_SYMFONY_MESSENGER
# Test against latest Symfony 4.4 dev
- php: 7.3
env: SYMFONY_REQUIRE="4.4.*" REQUIRE_SYMFONY_MESSENGER
# Test against latest Symfony 5.0 dev
- php: 7.3
env: SYMFONY_REQUIRE="5.0.*" REQUIRE_SYMFONY_MESSENGER
# Test dev versions
- php: 7.3
if: type = cron
env: DEV COMPOSER_FLAGS="-n --prefer-dist"
- stage: Coverage
php: 7.3
env: COVERAGE PHPUNIT_FLAGS="--coverage-clover=coverage.clover" REQUIRE_SYMFONY_MESSENGER
before_script:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi

View File

@@ -4,7 +4,7 @@ DoctrineMongoDBBundle
This bundle integrates the [Doctrine2 MongoDB Object Document Mapper (ODM) library](https://github.com/doctrine/mongodb-odm)
into Symfony so that you can persist and retrieve objects to and from MongoDB.
[![Build Status](https://secure.travis-ci.org/doctrine/DoctrineMongoDBBundle.png?branch=master)](http://travis-ci.org/doctrine/DoctrineMongoDBBundle)
[![Build Status](https://github.com/doctrine/DoctrineMongoDBBundle/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/DoctrineMongoDBBundle/actions)
Documentation on how to install and use this bundle is available in the
Symfony [documentation](http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html).