Add live Salesforce integration test coverage #119
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: | |
| branches: | |
| - master | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - ready_for_review | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| php: ['8.2', '8.3', '8.4', '8.5'] | |
| laravel: [11.x, 12.x, 13.x] | |
| dependency-version: [prefer-stable] | |
| exclude: | |
| - laravel: 10.x | |
| php: 8.1 | |
| - laravel: 11.x | |
| php: 8.1 | |
| - laravel: 12.x | |
| php: 8.1 | |
| - laravel: 10.x | |
| php: 8.4 | |
| - laravel: 10.x | |
| php: 8.5 | |
| - laravel: 11.x | |
| php: 8.5 | |
| - laravel: 13.x | |
| php: '8.2' | |
| name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Cache dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.composer/cache/files | |
| key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| coverage: none | |
| - name: Install dependencies | |
| run: | | |
| composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update | |
| composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest | |
| - name: Execute tests | |
| run: vendor/bin/phpunit | |
| salesforce-integration: | |
| runs-on: ubuntu-latest | |
| name: Salesforce Integration | |
| env: | |
| RUN_SALESFORCE_INTEGRATION_TESTS: true | |
| SF_CONSUMER_KEY: ${{ secrets.SF_CONSUMER_KEY }} | |
| SF_CONSUMER_SECRET: ${{ secrets.SF_CONSUMER_SECRET }} | |
| SF_LOGIN_URL: ${{ secrets.SF_LOGIN_URL }} | |
| SF_PASSWORD: ${{ secrets.SF_PASSWORD }} | |
| SF_USERNAME: ${{ secrets.SF_USERNAME }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| coverage: none | |
| - name: Mask Salesforce secrets | |
| run: | | |
| for value in "$SF_CONSUMER_KEY" "$SF_CONSUMER_SECRET" "$SF_LOGIN_URL" "$SF_PASSWORD" "$SF_USERNAME"; do | |
| if [ -n "$value" ]; then | |
| echo "::add-mask::$value" | |
| fi | |
| done | |
| - name: Resolve Salesforce test configuration | |
| id: salesforce-config | |
| run: | | |
| missing=0 | |
| for key in SF_CONSUMER_KEY SF_CONSUMER_SECRET SF_USERNAME SF_PASSWORD; do | |
| if [ -z "${!key}" ]; then | |
| echo "Missing Salesforce secret: $key" | |
| missing=1 | |
| fi | |
| done | |
| if [ -z "$SF_LOGIN_URL" ]; then | |
| echo "SF_LOGIN_URL=https://login.salesforce.com" >> "$GITHUB_ENV" | |
| fi | |
| if [ "$missing" -ne 0 ]; then | |
| echo "can_run=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| echo "can_run=true" >> "$GITHUB_OUTPUT" | |
| - name: Skip Salesforce integration test | |
| if: steps.salesforce-config.outputs.can_run != 'true' | |
| run: echo "Skipping Salesforce integration tests because the required GitHub secrets are not configured for this pull request." | |
| - name: Install dependencies | |
| if: steps.salesforce-config.outputs.can_run == 'true' | |
| run: composer update --prefer-stable --prefer-dist --no-interaction --no-suggest | |
| - name: Execute Salesforce integration test | |
| if: steps.salesforce-config.outputs.can_run == 'true' | |
| run: vendor/bin/phpunit --filter UserPasswordIntegrationTest |