Skip to content

Commit

Permalink
Try simplifying the noxfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ewjoachim committed Dec 1, 2024
1 parent 0e83c30 commit 05e182b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ jobs:
python-version: "3.12"
cache: "poetry"

- name: Get latest version
id: get-latest-version
run: gh release list --limit 1 --json tagName --jq '"checkout_ref="+.[0].tagName' >> $GITHUB_OUTPUT
- name: Get latest tag
id: get-latest-tag
run: gh release list --limit 1 --json tagName --jq '"latest_tag="+.[0].tagName' >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -109,7 +109,7 @@ jobs:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
LATEST_VERSION: ${{ steps.get-latest-version.outputs.checkout_ref }}
LATEST_TAG: ${{ steps.get-latest-tag.outputs.latest_tag }}

static-typing:
name: Run Pyright
Expand Down
24 changes: 7 additions & 17 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def current_version_without_post_migration(session: nox.Session):
latest_tag = fetch_latest_tag(session)
pre_migration = get_pre_migration(latest_tag)

session.install("poetry")
session.run("poetry", "install", "--all-extras")
session.run(
"poetry",
Expand All @@ -71,33 +70,24 @@ def stable_version_without_post_migration(session: nox.Session):
pre_migration = get_pre_migration(latest_tag)

with tempfile.TemporaryDirectory() as temp_dir:
session.chdir(temp_dir)

temp_path = pathlib.Path(temp_dir)
base_path = pathlib.Path(__file__).parent

# Install test dependencies and copy tests
shutil.copytree(base_path / "tests", temp_path / "tests")
shutil.copy(base_path / "pyproject.toml", temp_path / "pyproject.toml")
shutil.copy(base_path / "poetry.lock", temp_path / "poetry.lock")
session.chdir(temp_dir)
session.run("poetry", "install", "--with", "test", "--no-root")

session.install("poetry")
session.install("poetry-plugin-export")
session.run(
"poetry",
"export",
"--output",
"requirements.txt",
"--with",
"test",
"--all-extras",
"--without-hashes",
env={"POETRY_WARNINGS_EXPORT": "false"},
)
session.install("-r", "requirements.txt")
# Install latest procrastinate from PyPI
session.install("procrastinate")

session.run(
"pytest",
f"--migrate-until={pre_migration}",
f"--latest-version={latest_tag}",
"./tests/acceptance",
*session.posargs,
env={"PYTHONPATH": temp_dir},
)

0 comments on commit 05e182b

Please sign in to comment.