From a50eb4f1988e854c331714842a5cf46143197361 Mon Sep 17 00:00:00 2001 From: rmorshea Date: Wed, 31 May 2023 00:06:18 -0600 Subject: [PATCH] get workflows to run --- .github/workflows/publish.yml | 4 ++-- .github/workflows/test.yml | 16 +++++++--------- pyproject.toml | 5 +---- tasks.py | 10 ++++++++-- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 18090e4b0..d8af63e66 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,10 +9,10 @@ on: jobs: publish: - uses: ./.github/workflows/.nox-session.yml + uses: ./.github/workflows/.hatch-run.yml with: job-name: "publish" - nox-args: "-s publish" + hatch-run: "publish" secrets: node-auth-token: ${{ secrets.NODE_AUTH_TOKEN }} pypi-username: ${{ secrets.PYPI_USERNAME }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33b373f98..96a44e88f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,23 +15,21 @@ jobs: uses: ./.github/workflows/.hatch-run.yml with: job-name: "python-{0}" - hatch-run: "-t check-python" - nox-session-args: "--pytest --maxfail=3 --reruns 3" + hatch-run: "test-py --maxfail=3 --reruns=3 lint-py" python-environments: - uses: ./.github/workflows/.nox-session.yml + uses: ./.github/workflows/.hatch-run.yml with: job-name: "python-{0} {1}" - nox-args: "-s check-python-tests" - nox-session-args: "--no-cov --pytest --maxfail=3 --reruns 3" + hatch-run: "test-py --maxfail=3 --reruns=3 --no-cov" runs-on-array: '["ubuntu-latest", "macos-latest", "windows-latest"]' python-version-array: '["3.9", "3.10", "3.11"]' docs: - uses: ./.github/workflows/.nox-session.yml + uses: ./.github/workflows/.hatch-run.yml with: job-name: "python-{0}" - nox-args: "-s check-docs" + hatch-run: "test-docs" javascript: - uses: ./.github/workflows/.nox-session.yml + uses: ./.github/workflows/.hatch-run.yml with: job-name: "{1}" - nox-args: "-t check-javascript" + hatch-run: "test-js lint-js" diff --git a/pyproject.toml b/pyproject.toml index b9be2a426..8898c389c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,15 +14,12 @@ post-install-commands = ["invoke env"] [tool.hatch.envs.default.scripts] publish = "invoke publish {args}" -checks = ["lint", "test"] -lint = ["lint-py {args}", "lint-js {args}"] -test = ["test-py", "test-js"] - lint-py = "invoke lint-py {args}" lint-js = "invoke lint-js {args}" test-py = "invoke test-py {args}" test-js = "invoke test-js {args}" +test-docs = "invoke test-docs {args}" # --- Black ---------------------------------------------------------------------------- diff --git a/tasks.py b/tasks.py index dc0d444c0..916cd11f3 100644 --- a/tasks.py +++ b/tasks.py @@ -83,9 +83,10 @@ def lint_js(context: Context, fix: bool = False): @task -def test_py(context: Context, no_cov: bool = False): +def test_py(context: Context, no_cov: bool = False, **flags: str): """Run test suites""" - in_py(context, f"hatch run {'test' if no_cov else 'cov'}") + flags = " ".join(f"--{k}={v}" for k, v in flags.items()) + in_py(context, f"hatch run {'test' if no_cov else 'cov'} {flags}") @task @@ -94,6 +95,11 @@ def test_js(context: Context): in_js(context, "npm run check:tests") +@task +def test_docs(context: Context): + raise Exit("Not implemented") + + @task def publish(context: Context, dry_run: str = ""): """Publish packages that have been tagged for release in the current commit