-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Add 'no-creds' test in CI, fix "only on forks" condition of full …
…pytest suite, add pr check workflow (#145)
- Loading branch information
1 parent
2e28882
commit 16df499
Showing
3 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pr: | ||
description: 'PR Number' | ||
type: number | ||
required: true | ||
|
||
jobs: | ||
# This is copied from the `python_pytest.yml` file. | ||
# Only the first two steps of the job are different, and they check out the PR's branch. | ||
pytest-on-demand: | ||
name: On-Demand PR Pytest (All, Python ${{ matrix.python-version }}, ${{ matrix.os }}) | ||
# Don't run on forks. Run on pushes to main, and on PRs that are not from forks. | ||
strategy: | ||
matrix: | ||
python-version: [ | ||
'3.9', | ||
'3.10', | ||
'3.11', | ||
] | ||
os: [ | ||
Ubuntu, | ||
Windows, | ||
] | ||
fail-fast: false | ||
|
||
runs-on: "${{ matrix.os }}-latest" | ||
steps: | ||
|
||
# Custom steps to fetch the PR and checkout the code: | ||
|
||
- name: Fetch PR | ||
id: fetch-pr | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const pr = await github.pulls.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: ${{ github.event.inputs.pr }} | ||
}); | ||
return pr.data.head.sha; | ||
result-encoding: string | ||
- name: Checkout PR | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ steps.fetch-pr.outputs.result }} | ||
|
||
# Same as the `python_pytest.yml` file: | ||
|
||
- name: Set up Poetry | ||
uses: Gr1N/setup-poetry@v8 | ||
with: | ||
poetry-version: "1.7.1" | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'poetry' | ||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Run Pytest | ||
env: | ||
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }} | ||
run: poetry run pytest |