From d0437b40cd377f949df651e9915a5d0056f6df80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 28 Mar 2024 17:14:59 -0500 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=94=A7=20Explicitly=20include=20tests?= =?UTF-8?q?,=20docs=5Fsrc,=20requirements.txt=20files=20in=20sdist=20for?= =?UTF-8?q?=20redistributors=20(e.g.=20OpenSUSE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 280cd16412..ac95ed800c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,9 @@ all = [ version = { source = "file", path = "typer/__init__.py" } distribution = true +[tool.pdm.build] +source-includes = ["tests/", "docs_src/", "requirements*.txt"] + [tool.isort] profile = "black" known_third_party = ["typer", "click"] From d0f7cba77e2001e64a867355a22f7235bca66926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 28 Mar 2024 17:33:22 -0500 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=91=B7=20Start=20redistribution=20tes?= =?UTF-8?q?ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/redistribute.yml | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/redistribute.yml diff --git a/.github/workflows/redistribute.yml b/.github/workflows/redistribute.yml new file mode 100644 index 0000000000..b17c1bba1a --- /dev/null +++ b/.github/workflows/redistribute.yml @@ -0,0 +1,41 @@ +name: Test Redistribute + +on: + push: + branches: + - master + pull_request: + types: + - opened + - synchronize + +jobs: + test-redistribute: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + # Issue ref: https://github.com/actions/setup-python/issues/436 + # cache: "pip" + # cache-dependency-path: pyproject.toml + - name: Install build dependencies + run: pip install build + # TODO: remove this + # Allow debugging with tmate + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + - name: Build distribution + run: python -m build + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" From 24cb6baea964d28a9ce1fde648cc138180003bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 28 Mar 2024 17:45:55 -0500 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=94=A7=20Tweak=20redistribute=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/redistribute.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/redistribute.yml b/.github/workflows/redistribute.yml index b17c1bba1a..5218a481bb 100644 --- a/.github/workflows/redistribute.yml +++ b/.github/workflows/redistribute.yml @@ -34,7 +34,15 @@ jobs: with: limit-access-to-actor: true - name: Build distribution - run: python -m build + run: python -m build --sdist + - run: tar xvf typer*.tar.gz + working-directory: dist + - run: pip install -r requirements-tests.txt + working-directory: dist/typer-* + - run: pytest tests + working-directory: dist/typer-* + - run: pip wheel --no-deps typer-*.tar.gz + working-directory: dist - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} From 313b93a4c8cc3980a05c444123ab277d926234ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 28 Mar 2024 17:48:50 -0500 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=91=B7=20Tweak=20redistribute=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/redistribute.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/redistribute.yml b/.github/workflows/redistribute.yml index 5218a481bb..7357675f59 100644 --- a/.github/workflows/redistribute.yml +++ b/.github/workflows/redistribute.yml @@ -35,14 +35,18 @@ jobs: limit-access-to-actor: true - name: Build distribution run: python -m build --sdist - - run: tar xvf typer*.tar.gz - working-directory: dist - - run: pip install -r requirements-tests.txt - working-directory: dist/typer-* - - run: pytest tests - working-directory: dist/typer-* - - run: pip wheel --no-deps typer-*.tar.gz - working-directory: dist + - run: | + cd dist + tar xvf typer*.tar.gz + - run: | + cd dist/typer-* + pip install -r requirements-tests.txt + - run: | + cd dist/typer-* + pytest tests + - run: | + cd dist + pip wheel --no-deps typer-*.tar.gz - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} From bd8ff062b8bab82fe3372c57c60b690613ad138a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 28 Mar 2024 17:50:22 -0500 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=91=B7=20Tweak=20CI=20for=20redistrib?= =?UTF-8?q?ute?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/redistribute.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/redistribute.yml b/.github/workflows/redistribute.yml index 7357675f59..ee39f6c6d0 100644 --- a/.github/workflows/redistribute.yml +++ b/.github/workflows/redistribute.yml @@ -39,10 +39,10 @@ jobs: cd dist tar xvf typer*.tar.gz - run: | - cd dist/typer-* + cd dist/typer-*/ pip install -r requirements-tests.txt - run: | - cd dist/typer-* + cd dist/typer-*/ pytest tests - run: | cd dist From 5a0f0841f24f9256d80fe920998faa456df60bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 28 Mar 2024 17:54:23 -0500 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=94=A7=20Tweak=20tests=20to=20run=20s?= =?UTF-8?q?cript?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/redistribute.yml | 2 +- pyproject.toml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/redistribute.yml b/.github/workflows/redistribute.yml index ee39f6c6d0..57c2e2e7c2 100644 --- a/.github/workflows/redistribute.yml +++ b/.github/workflows/redistribute.yml @@ -43,7 +43,7 @@ jobs: pip install -r requirements-tests.txt - run: | cd dist/typer-*/ - pytest tests + bash scripts/test.sh - run: | cd dist pip wheel --no-deps typer-*.tar.gz diff --git a/pyproject.toml b/pyproject.toml index ac95ed800c..2ae5002fc8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,12 @@ version = { source = "file", path = "typer/__init__.py" } distribution = true [tool.pdm.build] -source-includes = ["tests/", "docs_src/", "requirements*.txt"] +source-includes = [ + "tests/", + "docs_src/", + "requirements*.txt", + "scripts/", + ] [tool.isort] profile = "black" From 8d549f8cba2ecdb0819261b48d52c1312c05ef1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 28 Mar 2024 17:56:32 -0500 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=94=A8=20Tweak=20how=20test=20files?= =?UTF-8?q?=20is=20run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 1 + scripts/test.sh | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8fcc70910e..6cef6278ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,6 +40,7 @@ jobs: - name: Lint run: bash scripts/lint.sh - run: mkdir coverage + - run: bash ./scripts/test-files.sh - name: Test run: bash scripts/test.sh env: diff --git a/scripts/test.sh b/scripts/test.sh index f0a7c9c779..32fa1e73f3 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -7,6 +7,5 @@ set -x export TERMINAL_WIDTH=3000 # Force disable terminal for tests inside of pytest, takes precedence over GITHUB_ACTIONS env var export _TYPER_FORCE_DISABLE_TERMINAL=1 -bash ./scripts/test-files.sh # It seems xdist-pytest ensures modified sys.path to import relative modules in examples keeps working pytest --cov --cov-report=term-missing -o console_output_style=progress --numprocesses=auto ${@} From 17fd436be33cc7af0e7c726a0afbabd62ede31ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 28 Mar 2024 18:07:05 -0500 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=94=A7=20Update=20test-distribute=20G?= =?UTF-8?q?itHub=20Action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...redistribute.yml => test-redistribute.yml} | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) rename .github/workflows/{redistribute.yml => test-redistribute.yml} (79%) diff --git a/.github/workflows/redistribute.yml b/.github/workflows/test-redistribute.yml similarity index 79% rename from .github/workflows/redistribute.yml rename to .github/workflows/test-redistribute.yml index 57c2e2e7c2..9ef1cde73c 100644 --- a/.github/workflows/redistribute.yml +++ b/.github/workflows/test-redistribute.yml @@ -27,24 +27,22 @@ jobs: # cache-dependency-path: pyproject.toml - name: Install build dependencies run: pip install build - # TODO: remove this - # Allow debugging with tmate - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - - name: Build distribution + - name: Build source distribution run: python -m build --sdist - - run: | + - name: Decompress source distribution + run: | cd dist tar xvf typer*.tar.gz - - run: | + - name: Install test dependencies + run: | cd dist/typer-*/ pip install -r requirements-tests.txt - - run: | + - name: Run source distribution tests + run: | cd dist/typer-*/ bash scripts/test.sh - - run: | + - name: Build wheel distribution + run: | cd dist pip wheel --no-deps typer-*.tar.gz - name: Dump GitHub context