fix(gha): use oidc to authenticate on codecov #84
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
name: Tests | |
on: | |
push: | |
branches: | |
- "master" | |
pull_request_target: | |
jobs: | |
build: | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
COMPOSER_ROOT_VERSION: dev-master | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
php_version: | |
- '8.1' | |
- '8.2' | |
- '8.3' | |
composer_flags: | |
- '' | |
- '-o' | |
name: 'PHP ${{ matrix.php_version }} (composer_flags: "${{ matrix.composer_flags }}")' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP with pecl extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php_version }} | |
extensions: :opcache, pcov | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v3 | |
with: | |
composer-options: ${{ matrix.composer_flags }} | |
- name: Install Composer dependencies (tests) | |
run: php tests/install-deps.php | |
env: | |
COMPOSER_FLAGS: ${{ matrix.composer_flags }} | |
- run: vendor/bin/phpunit | |
if: ${{ matrix.php_version != '8.2' }} | |
- run: vendor/bin/phpunit --coverage-clover coverage.xml | |
if: ${{ matrix.php_version == '8.2' }} | |
env: | |
XDEBUG_MODE: coverage | |
- name: Upload coverage to Codecov | |
if: ${{ matrix.php_version == '8.2' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
use_oidc: true | |
file: ./coverage.xml |