Update CI workflows to use composer update instead of `composer ins…
#3
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Code Style | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.1' | |
| tools: composer:v2 | |
| coverage: none | |
| - name: Install dependencies | |
| run: composer update --no-interaction --prefer-dist | |
| - name: Check code style | |
| run: PHP_CS_FIXER_IGNORE_ENV=1 composer lint | |
| test: | |
| name: Tests (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.1', '8.2', '8.3', '8.4'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| tools: composer:v2 | |
| coverage: xdebug | |
| - name: Install dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Run unit tests | |
| run: composer test:unit | |
| - name: Run integration tests | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| env: | |
| ASTROLOGY_API_KEY: ${{ secrets.ASTROLOGY_API_KEY }} | |
| run: composer test:integration | |
| coverage: | |
| name: Coverage | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| tools: composer:v2 | |
| coverage: xdebug | |
| - name: Install dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Generate coverage | |
| run: vendor/bin/phpunit --testsuite Unit --coverage-clover coverage.xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false |