|
| 1 | +name: Continuous Integration |
| 2 | + |
| 3 | +on: |
| 4 | + - push |
| 5 | + - pull_request |
| 6 | + |
| 7 | +jobs: |
| 8 | + tests: |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + include: |
| 12 | + - operating-system: 'ubuntu-latest' |
| 13 | + php-version: '8.1' |
| 14 | + |
| 15 | + - operating-system: 'windows-latest' |
| 16 | + php-version: '8.1' |
| 17 | + job-description: 'on Windows' |
| 18 | + |
| 19 | + - operating-system: 'macos-latest' |
| 20 | + php-version: '8.1' |
| 21 | + job-description: 'on macOS' |
| 22 | + |
| 23 | + name: PHP ${{ matrix.php-version }} ${{ matrix.job-description }} |
| 24 | + |
| 25 | + runs-on: ${{ matrix.operating-system }} |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Set git to use LF |
| 29 | + run: | |
| 30 | + git config --global core.autocrlf false |
| 31 | + git config --global core.eol lf |
| 32 | +
|
| 33 | + - name: Checkout code |
| 34 | + uses: actions/checkout@v2 |
| 35 | + |
| 36 | + - name: Setup PHP |
| 37 | + uses: shivammathur/setup-php@v2 |
| 38 | + with: |
| 39 | + php-version: ${{ matrix.php-version }} |
| 40 | + |
| 41 | + - name: Get Composer cache directory |
| 42 | + id: composer-cache |
| 43 | + run: echo "::set-output name=dir::$(composer config cache-dir)" |
| 44 | + |
| 45 | + - name: Cache dependencies |
| 46 | + uses: actions/cache@v2 |
| 47 | + with: |
| 48 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 49 | + key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-${{ matrix.composer-flags }} |
| 50 | + restore-keys: | |
| 51 | + composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}- |
| 52 | + composer-${{ runner.os }}-${{ matrix.php-version }}- |
| 53 | + composer-${{ runner.os }}- |
| 54 | + composer- |
| 55 | +
|
| 56 | + - name: Install dependencies |
| 57 | + uses: nick-invision/retry@v2 |
| 58 | + with: |
| 59 | + timeout_minutes: 5 |
| 60 | + max_attempts: 5 |
| 61 | + retry_wait_seconds: 30 |
| 62 | + command: | |
| 63 | + composer update --optimize-autoloader --no-interaction --no-progress ${{ matrix.composer-flags }} |
| 64 | + composer info -D |
| 65 | +
|
| 66 | + - name: Run tests |
| 67 | + run: vendor/bin/phpunit ${{ matrix.phpunit-flags }} |
| 68 | + |
| 69 | + - name: Run static analysis |
| 70 | + run: vendor/bin/psalm.phar |
| 71 | + |
| 72 | + - name: Run style fixer |
| 73 | + env: |
| 74 | + PHP_CS_FIXER_IGNORE_ENV: 1 |
| 75 | + run: vendor/bin/php-cs-fixer --diff --dry-run -v fix |
| 76 | + if: runner.os != 'Windows' |
| 77 | + |
| 78 | + - name: Install composer-require-checker |
| 79 | + run: php -r 'file_put_contents("composer-require-checker.phar", file_get_contents("https://github.com/maglnet/ComposerRequireChecker/releases/download/3.7.0/composer-require-checker.phar"));' |
| 80 | + if: runner.os != 'Windows' && matrix.composer-require-checker-version != 'none' |
| 81 | + |
| 82 | + - name: Run composer-require-checker |
| 83 | + run: php composer-require-checker.phar check composer.json --config-file $PWD/composer-require-check.json |
| 84 | + if: runner.os != 'Windows' && matrix.composer-require-checker-version != 'none' |
| 85 | + |
| 86 | + - name: Autobahn |
| 87 | + if: runner.os == 'Linux' |
| 88 | + shell: 'script -q -e -c "bash {0}"' |
| 89 | + run: | |
| 90 | + docker run -ti -d --rm -v ${PWD}/test-autobahn/config:/config -v ${PWD}/test-autobahn/reports:/reports -p 9001:9001 --name fuzzingserver crossbario/autobahn-testsuite |
| 91 | + php test-autobahn/runner.php |
0 commit comments