Test Fork PR #1
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: Test Fork PR | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'Pull Request number to test' | |
| required: true | |
| type: number | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: read | |
| env: | |
| PYTHON_VERSION: "3.11" | |
| UV_VERSION: "0.7.13" | |
| jobs: | |
| setup: | |
| name: Validate PR | |
| runs-on: ubuntu-latest | |
| outputs: | |
| head_sha: ${{ steps.pr-info.outputs.head_sha }} | |
| head_repo: ${{ steps.pr-info.outputs.head_repo }} | |
| steps: | |
| - name: Get PR information | |
| id: pr-info | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const pr = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: ${{ inputs.pr_number }} | |
| }); | |
| if (pr.data.state !== 'open') { | |
| core.setFailed(`PR #${{ inputs.pr_number }} is not open`); | |
| return; | |
| } | |
| if (pr.data.head.repo.full_name === `${context.repo.owner}/${context.repo.repo}`) { | |
| core.setFailed(`PR #${{ inputs.pr_number }} is not from a fork. Use the regular workflow.`); | |
| return; | |
| } | |
| core.setOutput('head_sha', pr.data.head.sha); | |
| core.setOutput('head_repo', pr.data.head.repo.full_name); | |
| console.log(`Testing PR #${{ inputs.pr_number }}`); | |
| console.log(` Head SHA: ${pr.data.head.sha}`); | |
| console.log(` Head Repo: ${pr.data.head.repo.full_name}`); | |
| service-tests: | |
| name: Service Tests | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: Create check run | |
| id: check | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const check = await github.rest.checks.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: 'Service Tests', | |
| head_sha: '${{ needs.setup.outputs.head_sha }}', | |
| status: 'in_progress', | |
| started_at: new Date().toISOString() | |
| }); | |
| core.setOutput('check_id', check.data.id); | |
| - name: Check out fork PR code | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: ${{ needs.setup.outputs.head_repo }} | |
| ref: ${{ needs.setup.outputs.head_sha }} | |
| - name: Run service tests | |
| uses: ./.github/actions/run-service-tests | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| uv-version: ${{ env.UV_VERSION }} | |
| env: | |
| HF_HOME: ${{ github.workspace }}/hf_cache | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| GCP_LOCATION: ${{ secrets.GCP_LOCATION }} | |
| GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
| COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | |
| MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} | |
| VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} | |
| AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | |
| AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} | |
| AZURE_OPENAI_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_DEPLOYMENT_NAME }} | |
| OPENAI_API_VERSION: ${{ secrets.OPENAI_API_VERSION }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| LANGCACHE_WITH_ATTRIBUTES_API_KEY: ${{ secrets.LANGCACHE_WITH_ATTRIBUTES_API_KEY }} | |
| LANGCACHE_WITH_ATTRIBUTES_CACHE_ID: ${{ secrets.LANGCACHE_WITH_ATTRIBUTES_CACHE_ID }} | |
| LANGCACHE_WITH_ATTRIBUTES_URL: ${{ secrets.LANGCACHE_WITH_ATTRIBUTES_URL }} | |
| LANGCACHE_NO_ATTRIBUTES_API_KEY: ${{ secrets.LANGCACHE_NO_ATTRIBUTES_API_KEY }} | |
| LANGCACHE_NO_ATTRIBUTES_CACHE_ID: ${{ secrets.LANGCACHE_NO_ATTRIBUTES_CACHE_ID }} | |
| LANGCACHE_NO_ATTRIBUTES_URL: ${{ secrets.LANGCACHE_NO_ATTRIBUTES_URL }} | |
| - name: Update check run (success) | |
| if: success() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| await github.rest.checks.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| check_run_id: ${{ steps.check.outputs.check_id }}, | |
| status: 'completed', | |
| conclusion: 'success', | |
| completed_at: new Date().toISOString() | |
| }); | |
| - name: Update check run (failure) | |
| if: failure() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| await github.rest.checks.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| check_run_id: ${{ steps.check.outputs.check_id }}, | |
| status: 'completed', | |
| conclusion: 'failure', | |
| completed_at: new Date().toISOString() | |
| }); |