From e90b322b38723f9eca4dd982bb4ff47649e654f7 Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 12:32:16 +0200 Subject: [PATCH 01/13] fix mypy inclusivity --- .github/workflows/lint-code.yml | 2 +- VERSIONLOG.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 0d67ba8b..55830a96 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -56,7 +56,7 @@ jobs: run: echo -e "y" | mypy --install-types **/*.py || exit 0 - name: mypy --> Static type checking # Configured in pyprojet.toml - run: mypy **/*.py + run: mypy . # Use pipreqs to check for missing dependencies pipreqs-check: diff --git a/VERSIONLOG.md b/VERSIONLOG.md index 4322f46c..b098c797 100644 --- a/VERSIONLOG.md +++ b/VERSIONLOG.md @@ -1,5 +1,9 @@ # TACA Version Log +## 20240617.1 + +Run mypy for entire repo regardless of depth. + ## 20240527.1 Use run-specific name to find Anglerfish samplesheet. From 437a026130700fdc4e6fc5e45b214a099b272fd2 Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 12:32:16 +0200 Subject: [PATCH 02/13] propagate change to stubs install --- .github/workflows/lint-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 55830a96..d67c2eae 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -53,7 +53,7 @@ jobs: pip install mypy # Start by installing type stubs - name: mypy --> Install stubs - run: echo -e "y" | mypy --install-types **/*.py || exit 0 + run: echo -e "y" | mypy --install-types . || exit 0 - name: mypy --> Static type checking # Configured in pyprojet.toml run: mypy . From e6840c788eb91c501c2b8d5161aeca94d94991a3 Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 12:32:16 +0200 Subject: [PATCH 03/13] update pipreqs script in CI --- .github/workflows/lint-code.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index d67c2eae..d3faf735 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -69,11 +69,10 @@ jobs: with: python-version: "3.10" - - name: Install pipreqs - run: pip install pipreqs - - - name: Install requirements - run: pip install -r requirements.txt + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pipreqs - name: Run pipreqs run: pipreqs --savepath pipreqs.txt taca @@ -81,8 +80,8 @@ jobs: - name: Compare requirements run: | # Extract and sort package names - awk -F'(=|==|>|>=|<|<=| @ )' '{print $1}' requirements.txt | sort -u > requirements.compare - awk -F'(=|==|>|>=|<|<=| @ )' '{print $1}' pipreqs.txt | sort -u > pipreqs.compare + awk -F'(=|==|>|>=|<|<=| @ )' '{print $1}' requirements.txt | tr '[:upper:]' '[:lower:]' | sort -u > requirements.compare + awk -F'(=|==|>|>=|<|<=| @ )' '{print $1}' pipreqs.txt | tr '[:upper:]' '[:lower:]' | sort -u > pipreqs.compare # Compare package lists if cmp -s requirements.compare pipreqs.compare From 2ff6574ca2bc59d64937a8844c218d94875c82ee Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 12:32:16 +0200 Subject: [PATCH 04/13] modernize pytest and codecov implementation --- .github/workflows/test-code.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-code.yml b/.github/workflows/test-code.yml index 8a06d7ac..1ff360e3 100644 --- a/.github/workflows/test-code.yml +++ b/.github/workflows/test-code.yml @@ -22,11 +22,8 @@ jobs: run: pip install -e . - name: pytest # Options are configured in pyproject.toml - run: pytest + run: pytest --cov=genologics --cov-report=xml - name: CodeCov - run: | - # Replace `linux` below with the appropriate OS - # Options are `alpine`, `linux`, `macos`, `windows` - curl -Os https://uploader.codecov.io/latest/linux/codecov - chmod +x codecov - ./codecov -t ${{ secrets.CODECOV_TOKEN }} + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} From 59e73bfc90514759f3e035801a5ef6174857db51 Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 12:32:16 +0200 Subject: [PATCH 05/13] bump vlog --- VERSIONLOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VERSIONLOG.md b/VERSIONLOG.md index b098c797..86a7001c 100644 --- a/VERSIONLOG.md +++ b/VERSIONLOG.md @@ -1,5 +1,9 @@ # TACA Version Log +## 20240701.1 + +Improve CI for pipreqs check and pytest/codecov + ## 20240617.1 Run mypy for entire repo regardless of depth. From 10ea5b096b3dc08d68ed8a6e8bb49d6b40a154fd Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 12:47:14 +0200 Subject: [PATCH 06/13] install all requirements to prevent non-PyPI packages from not being resolved --- .github/workflows/lint-code.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index d3faf735..9ced81c1 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -72,7 +72,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pipreqs + pip install -r requirements.txt + pip install -r requirements-dev.txt - name: Run pipreqs run: pipreqs --savepath pipreqs.txt taca From 0f671b60acc34dbff055a61155c7a440cb92c840 Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 12:53:07 +0200 Subject: [PATCH 07/13] try making pipreqs fail for unresolved packages --- .github/workflows/lint-code.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 9ced81c1..75dc07d6 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -76,7 +76,13 @@ jobs: pip install -r requirements-dev.txt - name: Run pipreqs - run: pipreqs --savepath pipreqs.txt taca + run: | + pipreqs --savepath pipreqs.txt taca 2>&1 | tee pipreqs_output.log + if grep -q 'WARNING: Package .* does not exist or network problems' pipreqs_output.log; then + echo "Unresolved packages or network issues detected in pipreqs output." + grep 'WARNING: Package .* does not exist or network problems' pipreqs_output.log + exit 1 + fi - name: Compare requirements run: | From 467976bc5dc3a32c4fc71c503e4dabd6bc0cbec4 Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 12:54:51 +0200 Subject: [PATCH 08/13] test failure for unresolved packages --- .github/workflows/lint-code.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 75dc07d6..a61acd62 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -72,8 +72,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements-dev.txt - name: Run pipreqs run: | From eaf2317518bbd83b51f18f740c9a9efaf463a52f Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 14:44:33 +0200 Subject: [PATCH 09/13] fix test --- .github/workflows/lint-code.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index a61acd62..86830109 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -72,6 +72,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + pip install pipreqs - name: Run pipreqs run: | From 119fdda08e0e5bf3bac8a18187f763f9d6dc70b1 Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 14:51:51 +0200 Subject: [PATCH 10/13] update test --- .github/workflows/lint-code.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 86830109..bef79593 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -78,8 +78,8 @@ jobs: run: | pipreqs --savepath pipreqs.txt taca 2>&1 | tee pipreqs_output.log if grep -q 'WARNING: Package .* does not exist or network problems' pipreqs_output.log; then - echo "Unresolved packages or network issues detected in pipreqs output." - grep 'WARNING: Package .* does not exist or network problems' pipreqs_output.log + grep 'ERROR: Found unresolved package .*' pipreqs_output.log + echo "Add unresolved packages to requirements, i.e. ' @ git+https://github.com//.git'" exit 1 fi From 33d08f3a8267849e300334a3faba90d45adf78bc Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 14:55:19 +0200 Subject: [PATCH 11/13] update test --- .github/workflows/lint-code.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index bef79593..6fe0158b 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -78,8 +78,7 @@ jobs: run: | pipreqs --savepath pipreqs.txt taca 2>&1 | tee pipreqs_output.log if grep -q 'WARNING: Package .* does not exist or network problems' pipreqs_output.log; then - grep 'ERROR: Found unresolved package .*' pipreqs_output.log - echo "Add unresolved packages to requirements, i.e. ' @ git+https://github.com//.git'" + echo "ERROR: Add unresolved packages to requirements, i.e. ' @ git+https://github.com//.git'" exit 1 fi From 4505c52869b832d80e141085fbac2f84e3191bf3 Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 14:57:40 +0200 Subject: [PATCH 12/13] update test --- .github/workflows/lint-code.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 6fe0158b..a88ddfb4 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -78,7 +78,8 @@ jobs: run: | pipreqs --savepath pipreqs.txt taca 2>&1 | tee pipreqs_output.log if grep -q 'WARNING: Package .* does not exist or network problems' pipreqs_output.log; then - echo "ERROR: Add unresolved packages to requirements, i.e. ' @ git+https://github.com//.git'" + missing_packages=$(grep 'WARNING: Package .* does not exist or network problems' pipreqs_output.log | sed -E 's/.*Package "(.*)" does not exist.*/\1/') + echo "ERROR: Add unresolved packages to requirements. Missing package(s): $missing_packages. Example: ' @ git+https://github.com//.git'" exit 1 fi From f8b743283563e1a231c0341ecba00df929d2d9f8 Mon Sep 17 00:00:00 2001 From: kedhammar Date: Mon, 1 Jul 2024 14:59:17 +0200 Subject: [PATCH 13/13] test failed appropriately, reset to pass --- .github/workflows/lint-code.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index a88ddfb4..59536920 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -72,7 +72,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pipreqs + pip install -r requirements.txt + pip install -r requirements-dev.txt - name: Run pipreqs run: |