chore(ci): Simplify Codecov upload gating #15
Workflow file for this run
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: Tests | |
| on: | |
| pull_request: | |
| merge_group: | |
| types: | |
| - checks_requested | |
| push: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| unit-tests: | |
| name: PHPUnit (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| continue-on-error: ${{ matrix.php == '8.5' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ["8.1", "8.2", "8.3", "8.4", "8.5"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: pcov | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.composer/cache/files | |
| key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php-${{ matrix.php }}-composer- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-interaction | |
| - name: Run unit tests (coverage leg) | |
| if: matrix.php == '8.1' | |
| run: composer test:coverage:ci | |
| - name: Run unit tests | |
| if: matrix.php != '8.1' | |
| run: composer test:unit | |
| - name: Upload coverage to Codecov | |
| if: matrix.php == '8.1' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: build/coverage.xml | |
| slug: oblakhost/rnids-rsreg-client-php | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| integration-live: | |
| name: Integration (live RNIDS) | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| env: | |
| RNIDS_EPP_USER: ${{ secrets.RNIDS_EPP_USER }} | |
| RNIDS_EPP_PASS: ${{ secrets.RNIDS_EPP_PASS }} | |
| RNIDS_EPP_CERT: ${{ secrets.RNIDS_EPP_CERT }} | |
| RNIDS_EPP_ROOT: ${{ secrets.RNIDS_EPP_ROOT }} | |
| steps: | |
| - name: Checkout | |
| if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }} | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.1" | |
| - name: Cache Composer dependencies | |
| if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }} | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.composer/cache/files | |
| key: ${{ runner.os }}-php-8.1-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php-8.1-composer- | |
| - name: Install dependencies | |
| if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }} | |
| run: composer install --prefer-dist --no-progress --no-interaction | |
| - name: Prepare RNIDS certificate fixtures | |
| if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }} | |
| run: | | |
| mkdir -p tests/fixtures | |
| printf '%s' '${{ secrets.RNIDS_EPP_CERT }}' > tests/fixtures/client.pem | |
| printf '%s' '${{ secrets.RNIDS_EPP_ROOT }}' > tests/fixtures/root.pem | |
| chmod 600 tests/fixtures/client.pem tests/fixtures/root.pem | |
| - name: Run live integration tests | |
| if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }} | |
| env: | |
| RNIDS_EPP_USERNAME: ${{ secrets.RNIDS_EPP_USER }} | |
| RNIDS_EPP_PASSWORD: ${{ secrets.RNIDS_EPP_PASS }} | |
| RNIDS_EPP_CLIENT_CERT_PATH: tests/fixtures/client.pem | |
| RNIDS_EPP_CA_CERT_PATH: tests/fixtures/root.pem | |
| run: composer test:live | |
| - name: Skip live integration tests (missing RNIDS secrets) | |
| if: ${{ env.RNIDS_EPP_USER == '' || env.RNIDS_EPP_PASS == '' || env.RNIDS_EPP_CERT == '' || env.RNIDS_EPP_ROOT == '' }} | |
| run: echo "RNIDS live integration job skipped because required secrets are missing." |