Main #3155
This file contains hidden or 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: Main | |
| on: | |
| push: | |
| branches: [ main, develop, wip ] | |
| # As of September 19, 2023, these paths-ignore patterns don't work due to | |
| # a bug in GitHub Actions See https://github.com/actions/runner/issues/2324 | |
| # Ditto below. | |
| paths-ignore: | |
| - '.idea/**' | |
| - '**/*.md' | |
| pull_request: | |
| branches: [ develop ] | |
| paths-ignore: | |
| - '.idea/**' | |
| - '**/*.md' | |
| schedule: | |
| # Every Monday at 00:00:00 UTC. | |
| # @see https://crontab.cronhub.io/ | |
| - cron: "0 0 * * 1" | |
| workflow_dispatch: | |
| jobs: | |
| static_analysis: | |
| name: "Static Analysis" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Set up PHP" | |
| uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action | |
| with: | |
| php-version: "8.2" | |
| coverage: none | |
| - name: "Checkout code" | |
| uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout | |
| - name: "Install dependencies" | |
| uses: ramsey/composer-install@v3 # https://github.com/marketplace/actions/install-php-dependencies-with-composer | |
| - name: "Run all static analysis tools" | |
| run: | | |
| composer validate | |
| composer dump-autoload --strict-psr --dry-run | |
| ./vendor/bin/phpcs | |
| ./vendor/bin/phpstan | |
| tests: | |
| name: "Tests: ${{ matrix.os }} / ${{ matrix.php }} / ${{ matrix.dependencies }}${{ matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' && ' w/ coverage' || '' }}" | |
| runs-on: "${{ matrix.os }}-latest" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu, macos, windows ] | |
| php: [ "8.1", "8.2", "8.3" ] | |
| dependencies: [ low, high ] | |
| steps: | |
| - name: "Install rsync" | |
| uses: GuillaumeFalourd/setup-rsync@v1.2 # https://github.com/marketplace/actions/setup-rsync | |
| - name: "Set up PHP w/ Coverage" | |
| if: ${{ matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' }} | |
| uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action | |
| with: | |
| php-version: "${{ matrix.php }}" | |
| extensions: gd | |
| ini-values: zend.assertions=1 | |
| - name: "Set up PHP w/o Coverage" | |
| if: ${{ !( matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' ) }} | |
| uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action | |
| with: | |
| php-version: "${{ matrix.php }}" | |
| coverage: none | |
| extensions: gd | |
| ini-values: zend.assertions=1 | |
| - name: "Debugging info" | |
| run: | | |
| echo "::group::PHP" | |
| which php | |
| php -i | |
| echo "::endgroup::" | |
| echo "::group::Composer" | |
| composer --version | |
| composer --format=json | jq '.' -C > composer-output.log | |
| head -5 composer-output.log | |
| echo "::endgroup::" | |
| echo "::group::rsync" | |
| which rsync | |
| rsync --version | |
| echo "::endgroup::" | |
| - name: "Checkout code" | |
| uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout | |
| - name: "Install dependencies" | |
| uses: ramsey/composer-install@v3 # https://github.com/marketplace/actions/install-composer-dependencies | |
| with: | |
| dependency-versions: "${{ matrix.dependencies }}est" | |
| - name: "Show installed versions" | |
| shell: bash | |
| env: | |
| NO_COLOR: "1" | |
| run: | | |
| output=$(composer show | awk '{print "- "$1" ("$2")"}') | |
| echo "$output" | |
| echo "Total packages: $(echo "$output" | wc -l | tr -d ' ')" | |
| - name: "Run core tests with coverage" | |
| run: "./vendor/bin/phpunit --testsuite=coverage --exclude-group=windows_only --colors=always" | |
| if: ${{ matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' }} | |
| # There's no reason to generate coverage data on multiple jobs--the result should be the same. | |
| - name: "Run core tests without coverage" | |
| run: "./vendor/bin/phpunit --no-coverage --exclude-group=windows_only --colors=always" | |
| if: ${{ runner.os != 'Windows' && !( matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' ) }} | |
| - name: "Run Windows tests" | |
| run: "./vendor/bin/phpunit --no-coverage --exclude-group=no_windows --colors=always" | |
| if: ${{ runner.os == 'Windows' }} |