fix(py): Type stubs for calibration types reflect breaking changes in 0.13.0 #15
Workflow file for this run
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
on: | ||
pull_request: | ||
name: Check pyQuil Compatibility | ||
jobs: | ||
check-pyquil: | ||
name: Check compatibility with pyQuil | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout quil-rs Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: quil-rs | ||
- name: Checkout pyQuil Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: "rigetti/pyquil" | ||
path: pyquil | ||
- name: Install Rust Toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- name: Restore Python Virtual Environment | ||
uses: syphar/restore-virtualenv@v1 | ||
- name: Setup pyQuil Repository | ||
run: | | ||
pip uninstall -y -r <(pip freeze) || true | ||
pip install "./pyquil[latex]" maturin mypy ruff pytest pytest-mock | ||
maturin develop -m quil-rs/quil-py/Cargo.toml | ||
- name: Run mypy | ||
id: mypy | ||
continue-on-error: true | ||
working-directory: ./pyquil | ||
run: | | ||
mypy pyquil | ||
- name: Run ruff | ||
id: ruff | ||
continue-on-error: true | ||
working-directory: ./pyquil | ||
run: | | ||
ruff check pyquil | ||
- name: Run pytest | ||
id: pytest | ||
continue-on-error: true | ||
working-directory: ./pyquil | ||
run: | | ||
pytest test/unit -x | ||
- name: Post PR Comment and Fail if Necessary | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
Check failure on line 61 in .github/workflows/validate-downstream.yml GitHub Actions / Check pyQuil CompatibilityInvalid workflow file
|
||
const mypyFailed = '${{ steps.mypy.outcome }}' === 'failure'; | ||
const ruffFailed = '${{ steps.ruff.outcome }}' === 'failure'; | ||
const pytestFailed = '${{ steps.pytest.outcome }}' === 'failure'; | ||
const constructLogURL = (stepId) => { | ||
return `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.id }}?pr=${{ context.issue.number }}` | ||
}; | ||
if (mypyFailed || ruffFailed || pytestFailed) { | ||
let body = `⚠️ **pyQuil Compatibility Checks Failed**:\n\n| Tool | Status |; | ||
if (mypyFailed) { | ||
body += `| mypy | ❌ Failed |\n`; | ||
} | ||
if (ruffFailed) { | ||
body += `| ruff | ❌ Failed |\n`; | ||
} | ||
if (pytestFailed) { | ||
body += `| pytest | ❌ Failed | [View Logs](${constructLogURL('pytest')}) |\n`; | ||
} | ||
body += `\n**Note**: These failures don't necessarily block the PR but both authors and reviewers should check the results for unintentional breaking changes.\n[View Logs]()\n`; | ||
// Post the failure comment | ||
await github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: body | ||
}); | ||
// Fail the job to show a red X | ||
core.setFailed("One or more pyQuil checks failed."); | ||
} else { // or post success | ||
let body = `✅ **pyQuil Compatibility Checks Passed** on Python \`${{ matrix.python-version }}\`. Great job!`; | ||
// Post the success comment | ||
await github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: body | ||
}); | ||
} |