Skip to content

Commit

Permalink
Use uv to simplify various CI jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Sep 3, 2024
1 parent 4101e74 commit 8a12443
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 44 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,12 @@ jobs:
with:
repository: typeshed-internal/stub_uploader
path: stub_uploader
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Run tests
run: |
cd stub_uploader
uv pip install -r requirements.txt --system
python -m pytest tests
uv run --python 3.12 --no-project --with-requirements requirements.txt pytest tests
# https://github.saobby.my.eu.orgmunity/t/run-github-actions-job-only-if-previous-job-has-failed/174786/2
create-issue-on-failure:
Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/meta_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/typecheck_typeshed.py --platform=${{ matrix.platform }}
- run: |
(
uv run \
--python=3.12 \
--no-project \
--with-requirements requirements-tests.txt \
./tests/typecheck_typeshed.py \
--platform=${{ matrix.platform }}
)
pyright:
name: Run pyright against the scripts and tests directories
runs-on: ubuntu-latest
Expand All @@ -63,18 +68,23 @@ jobs:
python-platform: ${{ matrix.python-platform }}
python-version: "3.9" # The Python version to test against.
project: ./pyrightconfig.scripts_and_tests.json

stubsabot-dry-run:
name: Stubsabot dry run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Git config
run: |
git config --global user.name stubsabot
git config --global user.email '<>'
- run: uv pip install -r requirements-tests.txt --system
- run: python scripts/stubsabot.py --action-level local
- run: |
(
uv run \
--python=3.12 \
--no-project \
--with-requirements requirements-tests.txt \
scripts/stubsabot.py \
--action-level local
)
63 changes: 34 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ jobs:
name: Check typeshed structure
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/check_typeshed_structure.py
- run: uv run --no-project --python 3.12 --with-requirements requirements-tests.txt tests/check_typeshed_structure.py

pytype:
name: Run pytype against the stubs
Expand Down Expand Up @@ -66,12 +61,17 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}
- run: |
(
uv run \
--python ${{ matrix.python-version }} \
--no-project \
--with-requirements requirements-tests.txt \
tests/mypy_test.py \
--platform=${{ matrix.platform }} \
--python-version=${{ matrix.python-version }}
)
# Run this as a separate job, as the other versions in the matrix are
# (and should be) run *using* the Python version we're testing the stubs for,
Expand All @@ -85,27 +85,36 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
allow-prereleases: true
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=3.13
- run: |
(
uv run \
--python=3.12 \
--no-project \
--with-requirements requirements-tests.txt \
tests/mypy_test.py \
--platform=${{ matrix.platform }} \
--python-version=3.13
)
regression-tests:
name: Run mypy on the test cases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
# Use py311 for now, as py312 seems to be around 30s slower in CI
# TODO: figure out why that is (#11590)
python-version: "3.11"
# Use py311 for now, as py312 seems to be around 30s slower in CI
# TODO: figure out why that is (#11590)
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/regr_test.py --all --verbosity QUIET
- run: |
(
uv run \
--python=3.11 \
--no-project \
--with-requirements requirements-tests.txt \
tests/regr_test.py \
--all \
--verbosity QUIET
)
pyright:
name: Test typeshed with pyright
Expand Down Expand Up @@ -176,13 +185,9 @@ jobs:
with:
repository: typeshed-internal/stub_uploader
path: stub_uploader
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Run tests
run: |
cd stub_uploader
uv pip install -r requirements.txt --system
python -m pytest tests
uv run --python=3.12 --no-project --with-requirements requirements.txt pytest tests

0 comments on commit 8a12443

Please sign in to comment.