Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test workflows #1

Merged
merged 10 commits into from
Sep 26, 2024
Merged
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
46 changes: 24 additions & 22 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ concurrency:
cancel-in-progress: true

jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
python: ${{ steps.filter.outputs.python }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
python:
- '**/*.py'
- 'pyproject.toml'
# changes:
# runs-on: ubuntu-latest
# permissions:
# pull-requests: read
# outputs:
# python: ${{ steps.filter.outputs.python }}
# steps:
# - uses: dorny/paths-filter@v3
# id: filter
# with:
# filters: |
# python:
# - '**/*.py'
# - 'pyproject.toml'

test-python:
runs-on: ${{ matrix.os }}
Expand All @@ -34,25 +34,27 @@ jobs:
fail-fast: false
matrix:
py: ['3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
# not today, windows-latest
os: [ubuntu-latest, macos-latest]

needs: changes
if: needs.changes.outputs.python == 'true'
# needs: changes
# if: needs.changes.outputs.python == 'true'
steps:
- uses: actions/checkout@v4
- uses: eifinger/setup-rye@v3
- uses: eifinger/setup-rye@v4 # replaces setup-python
id: setup-rye
with:
version: '0.34.0'
version: '0.39.0'
- run: rye pin ${{ matrix.py }}
- name: Sync
shell: pwsh
run: |
rye sync
if [[ $(git diff --stat requirements.lock) != '' ]]; then
echo 'Rye lockfile not up-to-date'
if (git diff --stat requirements.lock) {
Write-Output 'Rye lockfile not up-to-date'
git diff requirements.lock
exit 1
fi
}
- run: rye fmt --check
- run: rye lint
- run: rye run check
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ build-backend = "pdm.backend"

[tool.rye]
managed = true

# switch to true to generate cross-platform lockfiles when we support Windows
# which we don't
universal = false

dev-dependencies = [
"pyright>=1.1.377",
"pytest>=8.3.2",
Expand Down
8 changes: 7 additions & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
# all-features: false
# with-sources: false
# generate-hashes: false
# universal: false
# universal: true

-e file:.
click==8.1.7
# via jsi
colorama==0.4.6 ; sys_platform == 'win32' or platform_system == 'Windows'
# via click
# via loguru
# via pytest
humanize==4.10.0
# via jsi
iniconfig==2.0.0
Expand All @@ -37,3 +41,5 @@ pyright==1.1.378
pytest==8.3.2
rich==13.8.1
# via jsi
win32-setctime==1.1.0 ; sys_platform == 'win32'
# via loguru
4 changes: 3 additions & 1 deletion requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ psutil==6.0.0
# via jsi
pygments==2.18.0
# via rich
pyright==1.1.378
pyright==1.1.382.post0
# via jsi
rich==13.8.1
# via jsi
typing-extensions==4.12.2
# via pyright
5 changes: 3 additions & 2 deletions tests/test_process_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_cmd_options():
stderr="boop",
)
command.start()
stdout, stderr = command.communicate(timeout=0.1)
stdout, stderr = command.communicate(timeout=0.2)

print(f"{stdout=}")
print(f"{stderr=}")
Expand Down Expand Up @@ -165,7 +165,8 @@ def test_delayed_start_real_time():
assert not command.started()
assert not command.done()

time.sleep(0.2)
# give it some time to complete (allow some wiggle room for slow CI)
time.sleep(0.4)
assert command.started()
assert command.done()
assert command.returncode == 0
Expand Down