|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: |
| 4 | + - main |
| 5 | + pull_request: |
| 6 | + types: [opened, synchronize, reopened, ready_for_review] |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +defaults: |
| 13 | + run: |
| 14 | + shell: bash |
| 15 | + |
| 16 | +jobs: |
| 17 | + code_quality: |
| 18 | + name: Code Quality |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Install PHP |
| 24 | + uses: shivammathur/setup-php@v2 |
| 25 | + with: |
| 26 | + php-version: 8.2 |
| 27 | + tools: symfony-cli |
| 28 | + |
| 29 | + - name: Install Composer dependencies |
| 30 | + run: symfony composer install --prefer-dist --no-interaction --no-progress |
| 31 | + |
| 32 | + - name: Run Easy Coding Standard |
| 33 | + run: symfony php vendor/bin/ecs |
| 34 | + |
| 35 | + - name: Run PHPStan |
| 36 | + run: symfony php vendor/bin/phpstan analyze |
| 37 | + |
| 38 | + e2e: |
| 39 | + runs-on: ${{ matrix.os || 'ubuntu-latest' }} |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 44 | + php-version: [ '8.1', '8.2', '8.3', '8.4' ] |
| 45 | + dependency-version: [ '' ] |
| 46 | + symfony-version: [ '' ] |
| 47 | + minimum-stability: [ 'stable' ] |
| 48 | + include: |
| 49 | + # dev packages (probably not needed to have multiple such jobs) |
| 50 | + - minimum-stability: 'dev' |
| 51 | + php-version: '8.4' |
| 52 | + # lowest deps |
| 53 | + - php-version: '8.1' |
| 54 | + dependency-version: 'lowest' |
| 55 | + # LTS version of Symfony |
| 56 | + - php-version: '8.1' |
| 57 | + symfony-version: '6.4.*' |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + |
| 61 | + - name: Install PHP |
| 62 | + uses: shivammathur/setup-php@v2 |
| 63 | + with: |
| 64 | + php-version: 8.2 |
| 65 | + tools: symfony-cli, flex |
| 66 | + |
| 67 | + - name: Install Composer dependencies |
| 68 | + run: | |
| 69 | + symfony composer config minimum-stability ${{ matrix.minimum-stability }} |
| 70 | + SYMFONY_REQUIRE=${{ matrix.symfony-version || '>=6.4' }} symfony composer update ${{ matrix.dependency-version == 'lowest' && '--prefer-lowest' || '' }} |
| 71 | +
|
| 72 | + - name: Create a new Symfony project |
| 73 | + run: | |
| 74 | + git config --global user.email "[email protected]" |
| 75 | + git config --global user.name "Hugo Alliaume" |
| 76 | + case "${{ matrix.php-version }}" in |
| 77 | + 8.1) symfony new my_app --version="6.4.*" --webapp ;; |
| 78 | + 8.2) symfony new my_app --version="7.1.*" --webapp ;; |
| 79 | + 8.3) symfony new my_app --version="7.2.*" --webapp ;; |
| 80 | + 8.4) symfony new my_app --version="7.3.*" --webapp ;; |
| 81 | + esac |
| 82 | +
|
| 83 | + - name: Install kocal/oxlint-bundle |
| 84 | + working-directory: my_app |
| 85 | + run: | |
| 86 | + symfony composer config minimum-stability dev |
| 87 | + symfony composer config --json extra.symfony.allow-contrib 'true' |
| 88 | + symfony composer config repositories.oxlint-bundle '{"type":"path", "url":"../","options":{"symlink":true}}' |
| 89 | + |
| 90 | + cat << EOF > config/packages/kocal_oxlint.yaml |
| 91 | + when@dev: |
| 92 | + kocal_oxlint: |
| 93 | + binary_version: '1.8.0' |
| 94 | + EOF |
| 95 | + |
| 96 | + symfony composer require 'kocal/oxlint-bundle:*' --dev --no-interaction |
| 97 | + |
| 98 | + cat << EOF > .oxlintrc.json |
| 99 | + { |
| 100 | + "ignorePatterns": [ |
| 101 | + "assets/vendor/**", |
| 102 | + "public/assets/**", |
| 103 | + "public/bundles/**", |
| 104 | + "var/**", |
| 105 | + "vendor/**" |
| 106 | + ] |
| 107 | + } |
| 108 | + EOF |
| 109 | +
|
| 110 | + - name: Download the Oxlint CLI |
| 111 | + working-directory: my_app |
| 112 | + run: symfony console oxlint:download |
| 113 | + |
| 114 | + - name: Run Oxlint, which should fails (but it's expected!) |
| 115 | + working-directory: my_app |
| 116 | + run: bin/oxlint |
| 117 | + continue-on-error: true |
| 118 | + |
| 119 | + - name: Run Oxlint --fix |
| 120 | + working-directory: my_app |
| 121 | + run: bin/oxlint check . --write --unsafe |
| 122 | + |
| 123 | + - name: Run Oxlint, which should now pass |
| 124 | + working-directory: my_app |
| 125 | + run: bin/oxlint |
0 commit comments