Migrate GitHub Actions to Blacksmith runners #21
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
| # https://help.github.com/en/categories/automating-your-workflow-with-github-actions | |
| name: "Build" | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - "master" | |
| env: | |
| COMPOSER_ROOT_VERSION: "0.12.x-dev" | |
| jobs: | |
| lint: | |
| name: "Lint" | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| if: ${{ false }} | |
| strategy: | |
| matrix: | |
| php-version: | |
| - "7.1" | |
| - "7.2" | |
| - "7.3" | |
| - "7.4" | |
| - "8.0" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "${{ matrix.php-version }}" | |
| - name: "Validate Composer" | |
| run: "composer validate" | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Transform source code" | |
| if: matrix.php-version != '7.4' && matrix.php-version != '8.0' | |
| run: php bin/transform-source.php | |
| - name: "Lint" | |
| run: "make lint" | |
| coding-standards: | |
| name: "Coding Standard" | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| if: ${{ false }} | |
| strategy: | |
| matrix: | |
| php-version: | |
| - "8.0" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "${{ matrix.php-version }}" | |
| - name: "Validate Composer" | |
| run: "composer validate" | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Lint" | |
| run: "make lint" | |
| - name: "Coding Standard" | |
| run: "make cs" | |
| dependency-analysis: | |
| name: "Dependency Analysis" | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| if: ${{ false }} | |
| strategy: | |
| matrix: | |
| php-version: | |
| - "8.0" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "${{ matrix.php-version }}" | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Composer Require Checker" | |
| run: "make composer-require-checker" | |
| tests: | |
| name: "Tests" | |
| runs-on: ${{ matrix.operating-system }} | |
| if: ${{ false }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: | |
| - "7.3" | |
| - "7.4" | |
| - "8.0" | |
| operating-system: [ubuntu-latest, windows-latest] | |
| script: | |
| - "make tests" | |
| - "make tests-static-reflection" | |
| - "make tests-integration" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "${{ matrix.php-version }}" | |
| tools: pecl | |
| extensions: ds,mbstring | |
| ini-values: memory_limit=640M | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Transform source code" | |
| if: matrix.php-version != '7.4' && matrix.php-version != '8.0' | |
| run: php bin/transform-source.php | |
| - name: "Tests" | |
| run: "${{ matrix.script }}" | |
| tests-old-phpunit: | |
| name: "Tests with old PHPUnit" | |
| runs-on: ${{ matrix.operating-system }} | |
| if: ${{ false }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: | |
| - "7.1" | |
| - "7.2" | |
| operating-system: [ubuntu-latest, windows-latest] | |
| script: | |
| - "make tests-coverage" | |
| - "make tests-static-reflection-coverage" | |
| - "make tests-integration-coverage" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "${{ matrix.php-version }}" | |
| tools: pecl | |
| extensions: ds,mbstring | |
| ini-values: memory_limit=640M | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Downgrade PHPUnit" | |
| run: "composer require --dev phpunit/phpunit:^7.5.20 brianium/paratest:^4.0 --update-with-dependencies" | |
| - name: "Transform source code" | |
| run: php bin/transform-source.php | |
| - name: "Tests" | |
| run: "${{ matrix.script }}" | |
| tests-code-coverage: | |
| name: "Tests with code coverage" | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "pcov" | |
| php-version: "7.4" | |
| tools: pecl | |
| extensions: ds | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Tests" | |
| continue-on-error: true | |
| run: | | |
| php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude="~vendor~" vendor/bin/phpunit | |
| - name: "Coveralls" | |
| if: ${{ false }} | |
| env: | |
| COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| composer require twinh/php-coveralls --dev && \ | |
| vendor/bin/php-coveralls --verbose --coverage_clover=tests/tmp/clover.xml --json_path=tests/tmp/coveralls-upload.json | |
| - name: "DeepSource" | |
| env: | |
| DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} | |
| run: | | |
| curl https://deepsource.io/cli | sh && \ | |
| ./bin/deepsource report --analyzer test-coverage --key php --value-file tests/tmp/clover.xml | |
| static-analysis: | |
| name: "PHPStan" | |
| runs-on: ${{ matrix.operating-system }} | |
| if: ${{ false }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: | |
| - "7.1" | |
| - "7.2" | |
| - "7.3" | |
| - "7.4" | |
| - "8.0" | |
| operating-system: [ubuntu-latest, windows-latest] | |
| script: | |
| - "make phpstan" | |
| - "make phpstan-static-reflection" | |
| - "make phpstan-validate-stub-files" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "${{ matrix.php-version }}" | |
| extensions: mbstring | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Downgrade PHPUnit" | |
| if: matrix.php-version == '7.1' || matrix.php-version == '7.2' | |
| run: "composer require --dev phpunit/phpunit:^7.5.20 brianium/paratest:^4.0 --update-with-dependencies" | |
| - name: "Transform source code" | |
| if: matrix.php-version != '7.4' && matrix.php-version != '8.0' | |
| run: php bin/transform-source.php | |
| - name: "PHPStan" | |
| run: ${{ matrix.script }} | |
| static-analysis-with-result-cache: | |
| name: "PHPStan with result cache" | |
| if: ${{ false }} | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| strategy: | |
| matrix: | |
| php-version: | |
| - "7.4" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "${{ matrix.php-version }}" | |
| extensions: mbstring | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Cache Result cache" | |
| uses: actions/cache@v2 | |
| with: | |
| path: ./tmp | |
| key: "result-cache-v4" | |
| - name: "PHPStan with result cache" | |
| run: | | |
| make phpstan-result-cache | |
| bin/phpstan clear-result-cache -c build/phpstan.neon | |
| make phpstan-result-cache | |
| echo -e "\n\n" >> src/TrinaryLogic.php | |
| make phpstan-result-cache | |
| make phpstan-result-cache | |
| - name: "Upload result cache artifact" | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| name: resultCache-ubuntu-latest.php | |
| path: tmp/resultCache.php | |
| result-cache-e2e-tests: | |
| name: "Result cache E2E tests" | |
| runs-on: ${{ matrix.operating-system }} | |
| if: ${{ false }} | |
| strategy: | |
| matrix: | |
| php-version: | |
| - "7.4" | |
| operating-system: [ubuntu-latest, windows-latest] | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "${{ matrix.php-version }}" | |
| extensions: mbstring | |
| ini-values: memory_limit=256M | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Tests" | |
| run: | | |
| git clone https://github.com/nikic/PHP-Parser.git tests/e2e/PHP-Parser && git -C tests/e2e/PHP-Parser checkout v3.1.5 && composer install --working-dir tests/e2e/PHP-Parser && vendor/bin/phpunit tests/e2e/ResultCacheEndToEndTest.php | |
| compiler-tests: | |
| name: "Compiler Tests" | |
| if: ${{ false }} | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "7.3" | |
| - name: "Install dependencies" | |
| run: "composer install --no-dev --no-interaction --no-progress --no-suggest" | |
| - name: "Transform source code" | |
| run: php bin/transform-source.php | |
| - name: "Tests" | |
| run: | | |
| cd compiler && \ | |
| composer install --no-interaction && \ | |
| vendor/bin/phpunit -c tests/phpunit.xml tests && \ | |
| ../bin/phpstan analyse -l 8 src tests && \ | |
| php bin/compile && \ | |
| ../tmp/phpstan.phar list | |
| generate-baseline: | |
| name: "Generate baseline" | |
| if: ${{ false }} | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| strategy: | |
| matrix: | |
| php-version: | |
| - "7.4" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "${{ matrix.php-version }}" | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Generate baseline" | |
| run: | | |
| cp phpstan-baseline.neon phpstan-baseline-orig.neon && \ | |
| make phpstan-generate-baseline && \ | |
| diff phpstan-baseline.neon phpstan-baseline-orig.neon | |
| e2e-tests: | |
| name: "E2E tests" | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| if: ${{ false }} | |
| strategy: | |
| matrix: | |
| include: | |
| - script: "bin/phpstan analyse -l 8 -a tests/e2e/data/timecop.php tests/e2e/data/timecop.php" | |
| tools: "pecl" | |
| extensions: "timecop-beta" | |
| - script: "bin/phpstan analyse -l 8 -a tests/e2e/data/soap.php tests/e2e/data/soap.php" | |
| extensions: "soap" | |
| - script: "bin/phpstan analyse -l 8 -a tests/e2e/data/soap.php tests/e2e/data/soap.php" | |
| extensions: "" | |
| - script: "bin/phpstan analyse -l 8 tests/e2e/anon-class/Granularity.php" | |
| extensions: "" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v2" | |
| - name: "Install PHP" | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| coverage: "none" | |
| php-version: "7.4" | |
| tools: ${{ matrix.tools }} | |
| extensions: ${{ matrix.extensions }} | |
| - name: "Install dependencies" | |
| run: "composer install --no-interaction --no-progress --no-suggest" | |
| - name: "Test" | |
| run: ${{ matrix.script }} |