|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + - master |
| 8 | + - feature/** |
| 9 | + - bugfix/** |
| 10 | + - release/** |
| 11 | + paths: |
| 12 | + - src/** |
| 13 | + - tests/** |
| 14 | + - .github/workflows/build.yml |
| 15 | + pull_request: |
| 16 | + branches: |
| 17 | + - develop |
| 18 | + paths: |
| 19 | + - src/** |
| 20 | + - tests/** |
| 21 | + |
| 22 | +jobs: |
| 23 | + main: |
| 24 | + name: Build [PHP ${{ matrix.php-versions }}] |
| 25 | + runs-on: ubuntu-latest |
| 26 | + if: "!contains(github.event.head_commit.message, '[ci skip]')" |
| 27 | + |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + php-versions: ['7.3', '7.4'] |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v2 |
| 36 | + |
| 37 | + - name: Setup PHP, with composer and extensions |
| 38 | + uses: shivammathur/setup-php@master |
| 39 | + with: |
| 40 | + php-version: ${{ matrix.php-versions }} |
| 41 | + tools: composer |
| 42 | + extensions: curl, intl, mbstring, xdebug |
| 43 | + coverage: xdebug |
| 44 | + |
| 45 | + - name: Validate composer.json |
| 46 | + run: composer validate --strict |
| 47 | + |
| 48 | + - name: Get composer cache directory |
| 49 | + id: composer-cache |
| 50 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 51 | + |
| 52 | + - name: Create composer cache directory |
| 53 | + run: mkdir -p ${{ steps.composer-cache.outputs.dir }} |
| 54 | + |
| 55 | + - name: Cache composer dependencies |
| 56 | + uses: actions/cache@v2 |
| 57 | + with: |
| 58 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 59 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 60 | + restore-keys: ${{ runner.os }}-composer- |
| 61 | + |
| 62 | + - name: Create PHPStan cache directory |
| 63 | + run: mkdir -p build/phpstan |
| 64 | + |
| 65 | + - name: Cache PHPStan cache directory |
| 66 | + uses: actions/cache@v2 |
| 67 | + with: |
| 68 | + path: build/phpstan |
| 69 | + key: ${{ runner.os }}-phpstan-${{ github.sha }} |
| 70 | + restore-keys: ${{ runner.os }}-phpstan- |
| 71 | + |
| 72 | + - name: Setup Composer's GitHub OAuth access |
| 73 | + run: composer config --global github-oauth.github.com ${{ secrets.ACCESS_TOKEN }} |
| 74 | + |
| 75 | + - name: Install dependencies |
| 76 | + run: composer update --ansi --no-scripts --no-interaction |
| 77 | + |
| 78 | + - name: Run PHP-CS-Fixer |
| 79 | + run: vendor/bin/php-cs-fixer fix --ansi --config=.php_cs.dist --verbose --dry-run --using-cache=no |
| 80 | + |
| 81 | + - name: Run PHPStan Static Analysis Check |
| 82 | + run: vendor/bin/phpstan analyse --ansi |
| 83 | + |
| 84 | + - name: Run NexusPHP CS Config TestSuite |
| 85 | + run: vendor/bin/phpunit --colors=always |
| 86 | + |
| 87 | + - name: Run Coveralls |
| 88 | + run: | |
| 89 | + composer global require --ansi php-coveralls/php-coveralls |
| 90 | + php-coveralls --coverage_clover=build/logs/clover.xml -v |
| 91 | + env: |
| 92 | + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + COVERALLS_PARALLEL: true |
| 94 | + COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} |
| 95 | + |
| 96 | + coveralls-finish: |
| 97 | + name: Coveralls Finished |
| 98 | + needs: [main] |
| 99 | + runs-on: ubuntu-latest |
| 100 | + |
| 101 | + steps: |
| 102 | + - name: Upload to Coveralls API |
| 103 | + uses: coverallsapp/github-action@master |
| 104 | + with: |
| 105 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 106 | + parallel-finished: true |
0 commit comments