From 20b1be085e9ec49abc31056a06d9cdbfc7466a68 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 8 Mar 2024 22:04:06 +0100 Subject: [PATCH 01/10] ci: refactor Tox in action with `tox-gh` --- .github/workflows/tests.yml | 54 ++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4592194cc..b56b76840 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,52 +1,58 @@ ---- - -name: Tests +name: Tests with Tox on: [push, pull_request, workflow_dispatch] env: FORCE_COLOR: 1 +concurrency: + group: check-${{ github.ref }} + cancel-in-progress: true + jobs: test: + name: test with ${{ matrix.py }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - # when adding new versions, update the one used to test - # friend projects below to the latest one - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] - os: [ubuntu-latest, macos-latest, windows-latest] + py: + - "3.13" + - "3.12" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + os: + - ubuntu-latest + - macos-latest + - windows-latest exclude: # TODO Add Windows when regex wheel available for 3.13 - {os: windows-latest, python-version: "3.13"} - steps: - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} + with: + fetch-depth: 0 + - name: Setup python for test ${{ matrix.py }} uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.py }} allow-prereleases: true cache: pip - cache-dependency-path: .github/workflows/tests.yml - - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -U wheel - python -m pip install -U tox - - name: Download more tests from friend projects - if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' + if: matrix.py == '3.13' && runner.os == 'Linux' run: sh download-more-tests.sh - - name: Tox tests - run: | - tox -e py + + - name: Install tox + run: python -m pip install tox-gh>=1.2 + - name: Setup test suite + run: tox -vv --notest + - name: Run test suite + run: tox --skip-pkg-install - name: Upload coverage uses: codecov/codecov-action@v3 with: flags: ${{ matrix.os }} - name: ${{ matrix.os }} Python ${{ matrix.python-version }} + name: ${{ matrix.os }} Python ${{ matrix.py }} From 56aca5279a4f592d33664ef9fffbdfb0feeeb92a Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 8 Mar 2024 22:06:32 +0100 Subject: [PATCH 02/10] add [gh] --- tox.ini | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tox.ini b/tox.ini index e616fc791..a819281ea 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,15 @@ env_list = lint py{py3, 313, 312, 311, 310, 39, 38} +[gh] +python = + 3.13 = py313 + 3.12 = py312 + 3.11 = py311, type + 3.10 = py310 + 3.9 = py39 + 3.8 = py38 + [testenv] extras = tests From 1e57c9e176773784c0d05d42a626e55ef6259c16 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 8 Mar 2024 22:08:26 +0100 Subject: [PATCH 03/10] precommit --- tox.ini | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tox.ini b/tox.ini index a819281ea..c878b675d 100644 --- a/tox.ini +++ b/tox.ini @@ -5,15 +5,6 @@ env_list = lint py{py3, 313, 312, 311, 310, 39, 38} -[gh] -python = - 3.13 = py313 - 3.12 = py312 - 3.11 = py311, type - 3.10 = py310 - 3.9 = py39 - 3.8 = py38 - [testenv] extras = tests @@ -36,3 +27,12 @@ pass_env = PRE_COMMIT_COLOR commands = pre-commit run --all-files --show-diff-on-failure + +[gh] +python = + 3.13 = py313 + 3.12 = py312 + 3.11 = py311 + 3.10 = py310 + 3.9 = py39 + 3.8 = py38 From 8baa03294e65c1fed7544d4376d76aaa799317d0 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 8 Mar 2024 22:10:43 +0100 Subject: [PATCH 04/10] concurrency --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b56b76840..d57c27068 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,8 +6,8 @@ env: FORCE_COLOR: 1 concurrency: - group: check-${{ github.ref }} - cancel-in-progress: true + group: check-tests-tox-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: test: From 4ecfc8219b38702f24c2a68d178fac5a95d49e1e Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 8 Mar 2024 22:11:24 +0100 Subject: [PATCH 05/10] typo --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d57c27068..ef97fa6bf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ concurrency: jobs: test: - name: test with ${{ matrix.py }} on ${{ matrix.os }} + name: test with py${{ matrix.py }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -29,7 +29,7 @@ jobs: - windows-latest exclude: # TODO Add Windows when regex wheel available for 3.13 - - {os: windows-latest, python-version: "3.13"} + - {os: windows-latest, py: "3.13"} steps: - uses: actions/checkout@v4 with: From 53131d38e74ce34dcb8a80535c198cd9468f205e Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Sat, 9 Mar 2024 11:14:18 +0100 Subject: [PATCH 06/10] Concurrent name Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef97fa6bf..431012ea8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ env: FORCE_COLOR: 1 concurrency: - group: check-tests-tox-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: From 17abea16c3ca387cea5d6e87312197bda8d06cbc Mon Sep 17 00:00:00 2001 From: Jirka Date: Sat, 9 Mar 2024 15:58:08 +0100 Subject: [PATCH 07/10] cancel-in-progress --- .github/workflows/lint.yml | 5 ++++ .github/workflows/tests.yml | 48 ++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 850976317..0109f92ae 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,6 +8,11 @@ env: permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + # cancel all except push to main branch for have always full results + cancel-in-progress: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/main') }} + jobs: lint: runs-on: ubuntu-latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 431012ea8..775c435f8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,52 +7,46 @@ env: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + # cancel all except push to main branch for have always full results + cancel-in-progress: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/main') }} jobs: test: - name: test with py${{ matrix.py }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - py: - - "3.13" - - "3.12" - - "3.11" - - "3.10" - - "3.9" - - "3.8" - os: - - ubuntu-latest - - macos-latest - - windows-latest + # when adding new versions, update the one used to test + # friend projects below to the latest one + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + os: [ubuntu-latest, macos-latest, windows-latest] exclude: # TODO Add Windows when regex wheel available for 3.13 - - {os: windows-latest, py: "3.13"} + - {os: windows-latest, python-version: "3.13"} + steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup python for test ${{ matrix.py }} + + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: - python-version: ${{ matrix.py }} + python-version: ${{ matrix.python-version }} allow-prereleases: true cache: pip + cache-dependency-path: .github/workflows/tests.yml + + - name: Install dependencies + run: | + pip install -U wheel tox + - name: Download more tests from friend projects - if: matrix.py == '3.13' && runner.os == 'Linux' + if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' run: sh download-more-tests.sh - - - name: Install tox - run: python -m pip install tox-gh>=1.2 - - name: Setup test suite - run: tox -vv --notest - - name: Run test suite - run: tox --skip-pkg-install + - name: Tox tests + run: tox -e py - name: Upload coverage uses: codecov/codecov-action@v3 with: flags: ${{ matrix.os }} - name: ${{ matrix.os }} Python ${{ matrix.py }} + name: ${{ matrix.os }} Python ${{ matrix.python-version }} From f02ecc43ad0e5228d03790d0a8a2b08c2265331b Mon Sep 17 00:00:00 2001 From: Jirka Date: Sat, 9 Mar 2024 16:03:34 +0100 Subject: [PATCH 08/10] cleaning --- tox.ini | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tox.ini b/tox.ini index c878b675d..e616fc791 100644 --- a/tox.ini +++ b/tox.ini @@ -27,12 +27,3 @@ pass_env = PRE_COMMIT_COLOR commands = pre-commit run --all-files --show-diff-on-failure - -[gh] -python = - 3.13 = py313 - 3.12 = py312 - 3.11 = py311 - 3.10 = py310 - 3.9 = py39 - 3.8 = py38 From fe93154a8957161e6137973610701061a261d04e Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Sat, 9 Mar 2024 19:16:50 +0100 Subject: [PATCH 09/10] Apply suggestions from code review Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .github/workflows/tests.yml | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0109f92ae..bce5546c8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ permissions: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - # cancel all except push to main branch for have always full results + # cancel all except push to main branch to have always full results cancel-in-progress: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/main') }} jobs: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 775c435f8..8f9550a16 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,5 @@ -name: Tests with Tox +--- +name: Tests on: [push, pull_request, workflow_dispatch] @@ -7,7 +8,7 @@ env: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - # cancel all except push to main branch for have always full results + # cancel all except push to main branch to have always full results cancel-in-progress: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/main') }} jobs: @@ -43,7 +44,8 @@ jobs: if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' run: sh download-more-tests.sh - name: Tox tests - run: tox -e py + run: | + tox -e py - name: Upload coverage uses: codecov/codecov-action@v3 From 7088b49da5f5a9e1fee51ee4ecbe12f7a0b2d34b Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Mon, 11 Mar 2024 15:59:37 +0100 Subject: [PATCH 10/10] just extra pip Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8f9550a16..651f48ae7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,8 @@ jobs: - name: Install dependencies run: | - pip install -U wheel tox + pip install -U pip + pip install -U tox - name: Download more tests from friend projects if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest'