Add NativeEnumTypeConfig
to generate native PHP enums
#107
Workflow file for this run
This file contains 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 | |
on: | |
pull_request: | |
push: | |
branches: | |
- "master" | |
jobs: | |
composer-validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
coverage: none | |
extensions: mbstring | |
php-version: 8.3 | |
- run: composer validate | |
static-code-analysis: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: | |
- 7.4 | |
- 8.0 | |
- 8.1 | |
- 8.2 | |
- 8.3 | |
- 8.4 | |
dependencies: | |
- lowest | |
- highest | |
exclude: | |
# Problematic because those PHP versions allow nette/php-generator 3 which can not generate native enums | |
- php-version: 8.1 | |
dependencies: lowest | |
- php-version: 8.2 | |
dependencies: lowest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
coverage: none | |
extensions: mbstring | |
php-version: 8.3 | |
- uses: ramsey/composer-install@v3 | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
# We require PHP 8.1 to generate native enums. | |
# Thus, the generated output differs in other versions, so we regenerate the code there. | |
# This is not ideal as it makes CodegenTest less useful, but allows us to move forward with native enums. | |
- if: ${{ matrix.php-version <= '8.1' }} | |
run: make approve | |
- run: vendor/bin/phpstan analyse --configuration=phpstan.neon | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: | |
- 7.4 | |
- 8.0 | |
- 8.1 | |
- 8.2 | |
- 8.3 | |
- 8.4 | |
dependencies: | |
- lowest | |
- highest | |
exclude: | |
# Problematic because those PHP versions allow nette/php-generator 3 which can not generate native enums | |
- php-version: 8.1 | |
dependencies: lowest | |
- php-version: 8.2 | |
dependencies: lowest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
coverage: none | |
extensions: mbstring | |
php-version: ${{ matrix.php-version }} | |
- uses: ramsey/composer-install@v3 | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
# We require PHP 8.1 to generate native enums. | |
# Thus, the generated output differs in other versions, so we regenerate the code there. | |
# This is not ideal as it makes CodegenTest less useful, but allows us to move forward with native enums. | |
- if: ${{ matrix.php-version <= '8.1' }} | |
run: make approve | |
- run: vendor/bin/phpunit | |
examples: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
example: | |
- custom-types | |
- input | |
- install | |
- php-keywords | |
- simple | |
- polymorphic | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
coverage: none | |
extensions: mbstring | |
php-version: 8.3 | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: cd examples/${{ matrix.example }} && ./test.sh | |
code-coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
coverage: pcov | |
extensions: mbstring | |
php-version: 8.3 | |
- uses: ramsey/composer-install@v3 | |
- run: vendor/bin/phpunit --coverage-clover=build/logs/clover.xml | |
# Not using v4 due to the breaking changes described in https://github.com/codecov/codecov-action/releases/tag/v4.0.0 | |
- uses: codecov/codecov-action@v3 |