Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions .github/workflows/lint.yml

This file was deleted.

38 changes: 27 additions & 11 deletions .github/workflows/test-fork-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Fork PR
name: Test External PR

on:
workflow_dispatch:
Expand All @@ -22,6 +22,7 @@ jobs:
name: Validate PR
runs-on: ubuntu-latest
outputs:
pr_number: ${{ steps.pr-info.outputs.pr_number }}
head_sha: ${{ steps.pr-info.outputs.head_sha }}
head_repo: ${{ steps.pr-info.outputs.head_repo }}
steps:
Expand All @@ -41,11 +42,17 @@ jobs:
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.`);
const isForkPr = pr.data.head.repo.full_name !== `${context.repo.owner}/${context.repo.repo}`;
const isDependabotPr = pr.data.user.login === 'dependabot[bot]';

if (!isForkPr && !isDependabotPr) {
core.setFailed(
`PR #${{ inputs.pr_number }} is neither from a fork nor authored by dependabot[bot]. Use the regular workflow.`
);
return;
}

core.setOutput('pr_number', String(pr.data.number));
core.setOutput('head_sha', pr.data.head.sha);
core.setOutput('head_repo', pr.data.head.repo.full_name);

Expand All @@ -63,21 +70,29 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const check = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'Fork PR - Service Tests',
name: 'External PR - Service Tests',
head_sha: '${{ needs.setup.outputs.head_sha }}',
status: 'in_progress',
started_at: new Date().toISOString()
started_at: new Date().toISOString(),
details_url: runUrl,
output: {
title: 'External PR Service Tests Running',
summary: `Service tests are in progress for PR #${{ needs.setup.outputs.pr_number }} at commit ${{ needs.setup.outputs.head_sha }}.`,
text: `[View Active Run](${runUrl})\n\nPR: #${{ needs.setup.outputs.pr_number }}\nHead SHA: ${{ needs.setup.outputs.head_sha }}`
}
});
core.setOutput('check_id', check.data.id);

- name: Check out fork PR code
- name: Check out external PR code
uses: actions/checkout@v6
with:
repository: ${{ needs.setup.outputs.head_repo }}
ref: ${{ needs.setup.outputs.head_sha }}
persist-credentials: false

- name: Run service tests
uses: ./.github/actions/run-service-tests
Expand Down Expand Up @@ -121,8 +136,9 @@ jobs:
completed_at: new Date().toISOString(),
details_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
output: {
title: 'Service Tests Passed',
summary: `All service tests passed for PR #${{ inputs.pr_number }}.`
title: 'External PR Service Tests Passed',
summary: `All service tests passed for PR #${{ needs.setup.outputs.pr_number }}.`,
text: `[View Active Run](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})\n\nPR: #${{ needs.setup.outputs.pr_number }}\nHead SHA: ${{ needs.setup.outputs.head_sha }}`
}
});

Expand All @@ -140,8 +156,8 @@ jobs:
completed_at: new Date().toISOString(),
details_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
output: {
title: 'Service Tests Failed',
summary: `The service tests failed for PR #${{ inputs.pr_number }}. Click "Details" to view the full test output and logs.`,
text: `**Workflow Run:** [View Details](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})\n\n**PR:** #${{ inputs.pr_number }}\n**Commit:** ${{ needs.setup.outputs.head_sha }}`
title: 'External PR Service Tests Failed',
summary: `The service tests failed for PR #${{ needs.setup.outputs.pr_number }}. Click "Details" to view the full test output and logs.`,
text: `[View Active Run](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})\n\nPR: #${{ needs.setup.outputs.pr_number }}\nHead SHA: ${{ needs.setup.outputs.head_sha }}`
}
});
52 changes: 50 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,58 @@
UV_VERSION: "0.7.13"

jobs:
lint:
name: Lint ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"

steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Install Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
python-version: ${{ matrix.python-version }} # sets UV_PYTHON
cache-dependency-glob: |
pyproject.toml
uv.lock

- name: Install dependencies
run: |
uv sync --all-extras --frozen

- name: check-sort-import
run: |
make check-sort-imports

- name: check-black-format
run: |
make check-format

- name: check-mypy
run: |
make check-types

service-tests:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: Service Tests
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
needs: lint
if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]')
Comment thread
vishal-bala marked this conversation as resolved.
Comment thread
cursor[bot] marked this conversation as resolved.
steps:
- name: Check out repository
uses: actions/checkout@v6
Expand Down Expand Up @@ -56,7 +104,7 @@
test:
name: Python ${{ matrix.python-version }} - redis-py ${{ matrix.redis-py-version }} [${{ matrix.redis-image }}]
runs-on: ubuntu-latest
needs: service-tests
needs: lint
env:
HF_HOME: ${{ github.workspace }}/hf_cache
strategy:
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading