From a88916b3c0af943616a9e2d69f369df9d933622d Mon Sep 17 00:00:00 2001 From: Ben Diehl Date: Fri, 24 May 2024 21:12:42 +0000 Subject: [PATCH 1/8] shuffle config to have coverage be explicit --- setup.cfg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.cfg b/setup.cfg index 135110e..a9fa101 100644 --- a/setup.cfg +++ b/setup.cfg @@ -52,7 +52,6 @@ audit = aequitas>=1.0.0 dev = autopep8>=1.3.5 - pytest-cov>=2.5.1 pytest-json>=0.4.0 pytest>=5.1.1 traitlets>=5.1.1 @@ -71,25 +70,26 @@ docs = [tool:pytest] -addopts = --cov-config=setup.cfg --cov=seismometer --cov-report=term --cov-report=html --cov-report=xml:coverage/coverage.xml testpaths = tests -json_report = coverage/test-report.json -jsonapi = True filterwarnings = ignore::UserWarning ignore::PendingDeprecationWarning [coverage:run] +source = seismometer branch = True [coverage:report] -fail_under = 70 +fail_under = 90 omit = */plot/mpl/* [coverage:html] directory = coverage/html-report +[coverage:xml] +output = coverage/coverage.xml + [tool:isort] line_length = 119 profile = black From 887a0f8f661da06218d20bf38215190e3e315823 Mon Sep 17 00:00:00 2001 From: Ben Diehl Date: Fri, 24 May 2024 21:13:44 +0000 Subject: [PATCH 2/8] test coverage and test packaging --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef7f20b..c90bd8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: permissions: "read-all" jobs: - run-linting: + linting: name: linting via pre-commit runs-on: ubuntu-latest @@ -18,7 +18,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.10" - name: Install pre-commit run: | pip install --upgrade pip @@ -26,8 +26,8 @@ jobs: - name: Run pre-commit steps run: | pre-commit run --all-files - run-tests: - name: tests via pytest + test-coverage: + name: Test base configuration with coverage runs-on: ubuntu-latest steps: @@ -36,17 +36,44 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.10" - name: Install dependencies run: | pip install --upgrade pip pip install -e .[dev,audit] - name: Run tests run: | - pytest . + coverage run -m pytest + - name: Generate coverage report + run: | + coverage xml + - name: Generate htmp report for inspection + if: failure() + run: | + coverage html - name: Upload coverage + if: always() uses: actions/upload-artifact@v4 with: name: coverage-data path: coverage/coverage.xml if-no-files-found: error + test-packaging: + name: Test packaging + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Install dependencies + run: | + pip install --upgrade pip + pip install build twine + - name: Build package + run: | + python -m build + python -m twine check dist/* From f2ed6c37299ce4cbccd19f20737db0b104efc403 Mon Sep 17 00:00:00 2001 From: Ben Diehl Date: Fri, 24 May 2024 21:31:26 +0000 Subject: [PATCH 3/8] need coverage --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index a9fa101..5110985 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,6 +51,7 @@ all = audit = aequitas>=1.0.0 dev = + coverage>=7.5.1 autopep8>=1.3.5 pytest-json>=0.4.0 pytest>=5.1.1 From c98a0ad321020bff2edbdf3ec17fa2e46fd68c24 Mon Sep 17 00:00:00 2001 From: Ben Diehl Date: Tue, 28 May 2024 11:48:55 +0000 Subject: [PATCH 4/8] update job names --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c90bd8b..526e2b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ permissions: "read-all" jobs: linting: - name: linting via pre-commit + name: Linting runs-on: ubuntu-latest steps: @@ -27,7 +27,7 @@ jobs: run: | pre-commit run --all-files test-coverage: - name: Test base configuration with coverage + name: Coverage py3.10 runs-on: ubuntu-latest steps: @@ -44,19 +44,19 @@ jobs: - name: Run tests run: | coverage run -m pytest - - name: Generate coverage report + - name: Generate xml run: | coverage xml - - name: Generate htmp report for inspection + - name: Generate html if: failure() run: | coverage html - - name: Upload coverage + - name: Upload report if: always() uses: actions/upload-artifact@v4 with: name: coverage-data - path: coverage/coverage.xml + path: coverage/* if-no-files-found: error test-packaging: name: Test packaging From 48694989bcc07e23d5d32913a6a3d55fdb58a223 Mon Sep 17 00:00:00 2001 From: Ben Diehl Date: Tue, 28 May 2024 12:11:55 +0000 Subject: [PATCH 5/8] setup env matrix --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 526e2b1..497daa5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,3 +77,37 @@ jobs: run: | python -m build python -m twine check dist/* + test-versions: + # Limit matrix to after base is passing + needs: [test-coverage, linting, test-packaging] + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + os: + - ubuntu-latest + - windows-latest + - macos-latest + include: + - experimental: false + # Install is not robust in 3.12 + - python-version: "3.12" + experimental: true + + name: Test python-${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -e .[dev,audit] + - name: Run tests + run: | + pytest From c52da267105b97a690305b0e4dc0a45f6d6e0883 Mon Sep 17 00:00:00 2001 From: Ben Diehl Date: Tue, 28 May 2024 12:16:07 +0000 Subject: [PATCH 6/8] lower coverage threshold to current --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 5110985..1dca8e3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -81,7 +81,7 @@ source = seismometer branch = True [coverage:report] -fail_under = 90 +fail_under = 70 omit = */plot/mpl/* From ed21098daac43a93575d0781b843e44046751d6b Mon Sep 17 00:00:00 2001 From: Ben Diehl Date: Tue, 28 May 2024 19:55:30 +0000 Subject: [PATCH 7/8] refine step names --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 497daa5..7ebe032 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,9 +44,10 @@ jobs: - name: Run tests run: | coverage run -m pytest - - name: Generate xml + - name: Generate report run: | coverage xml + coverage report - name: Generate html if: failure() run: | From 3ff50d3e3df060b76181d5a8ae551ffe1f6f3510 Mon Sep 17 00:00:00 2001 From: Ben Diehl Date: Wed, 29 May 2024 17:56:38 +0000 Subject: [PATCH 8/8] remove known failure variants --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ebe032..0934e35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,16 +84,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11"] os: - ubuntu-latest - windows-latest - macos-latest include: - experimental: false - # Install is not robust in 3.12 - - python-version: "3.12" - experimental: true name: Test python-${{ matrix.python-version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }}