|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + tags: |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ${{matrix.os}} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + php: ['7.1', '7.2', '7.3', '7.4'] |
| 15 | + os: ['ubuntu-latest'] |
| 16 | + mongodb: ['3.6', '4.0', '4.2'] |
| 17 | + services: |
| 18 | + mongo: |
| 19 | + image: mongo:${{ matrix.mongodb }} |
| 20 | + ports: |
| 21 | + - 27017:27017 |
| 22 | + mysql: |
| 23 | + image: mysql:5.7 |
| 24 | + ports: |
| 25 | + - 3307:3306 |
| 26 | + env: |
| 27 | + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' |
| 28 | + MYSQL_DATABASE: 'unittest' |
| 29 | + MYSQL_ROOT_PASSWORD: |
| 30 | + name: PHP v${{ matrix.php }} with Mongo v${{ matrix.mongodb }} |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v1 |
| 34 | + - name: Show PHP version |
| 35 | + run: php${{ matrix.php }} -v && composer -V |
| 36 | + - name: Show Docker version |
| 37 | + run: if [[ "$DEBUG" == "true" ]]; then docker version && env; fi |
| 38 | + env: |
| 39 | + DEBUG: ${{secrets.DEBUG}} |
| 40 | + - name: Download Composer cache dependencies from cache |
| 41 | + id: composer-cache |
| 42 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 43 | + - name: Cache Composer dependencies |
| 44 | + uses: actions/cache@v1 |
| 45 | + with: |
| 46 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 47 | + key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 48 | + restore-keys: ${{ matrix.os }}-composer- |
| 49 | + - name: Install dependencies |
| 50 | + run: | |
| 51 | + composer install --no-interaction |
| 52 | + - name: Run tests |
| 53 | + run: | |
| 54 | + ./vendor/bin/phpunit --coverage-clover coverage.xml |
| 55 | + env: |
| 56 | + MONGO_HOST: 0.0.0.0 |
| 57 | + MYSQL_HOST: 0.0.0.0 |
| 58 | + MYSQL_PORT: 3307 |
| 59 | + - name: Send coveralls |
| 60 | + run: vendor/bin/coveralls coverage.xml |
| 61 | + env: |
| 62 | + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + - uses: codecov/codecov-action@v1 |
| 64 | + with: |
| 65 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 66 | + fail_ci_if_error: false |
0 commit comments