From 841ae2006ed69194a6fe284f72bf04dc51346f76 Mon Sep 17 00:00:00 2001 From: Athanasius <Athanasius@miggy.org> Date: Fri, 23 Dec 2022 15:06:47 +0000 Subject: [PATCH 1/6] mypy: Add script to run against all, and use in github/push-checks --- .github/workflows/push-checks.yml | 4 ++++ scripts/mypy-all.sh | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 scripts/mypy-all.sh diff --git a/.github/workflows/push-checks.yml b/.github/workflows/push-checks.yml index e0c98897..5fdd1a14 100644 --- a/.github/workflows/push-checks.yml +++ b/.github/workflows/push-checks.yml @@ -59,3 +59,7 @@ jobs: grep -E -z -Z '\.py$' | \ xargs -0 flake8 --count --statistics --extend-ignore D ####################################################################### + + - name: mypy type checks + run: | + ./scripts/mypy-all.sh diff --git a/scripts/mypy-all.sh b/scripts/mypy-all.sh new file mode 100644 index 00000000..71f2f958 --- /dev/null +++ b/scripts/mypy-all.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# + +mypy $(git ls-tree --full-tree -r --name-only HEAD | grep -E '\.py$') From 8bacbf77ff2f4e42daaa63b9fc47dc766d06158b Mon Sep 17 00:00:00 2001 From: Athanasius <Athanasius@miggy.org> Date: Fri, 23 Dec 2022 15:11:56 +0000 Subject: [PATCH 2/6] github/push-checks: Run on any branch except main, stable, beta, releases --- .github/workflows/push-checks.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push-checks.yml b/.github/workflows/push-checks.yml index 5fdd1a14..0ebd6dee 100644 --- a/.github/workflows/push-checks.yml +++ b/.github/workflows/push-checks.yml @@ -9,7 +9,12 @@ name: Push-Checks on: push: - branches: [ develop ] + # We'll catch issues on `develop` or any PR branch. + branches-ignore: + - 'main' + - 'stable' + - 'releases' + - 'beta' jobs: build: From e70b3c99f2cd63d3e35c0b0167331b0bede33366 Mon Sep 17 00:00:00 2001 From: Athanasius <Athanasius@miggy.org> Date: Fri, 23 Dec 2022 15:18:32 +0000 Subject: [PATCH 3/6] github/push-checks: Correct the job name, from `build` --- .github/workflows/push-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push-checks.yml b/.github/workflows/push-checks.yml index 0ebd6dee..b483ebb0 100644 --- a/.github/workflows/push-checks.yml +++ b/.github/workflows/push-checks.yml @@ -17,7 +17,7 @@ on: - 'beta' jobs: - build: + push_checks: runs-on: ubuntu-22.04 From 862565e95507fcdbde5f30902cf8e3381b1e4159 Mon Sep 17 00:00:00 2001 From: A_D <aunderscored@gmail.com> Date: Fri, 23 Dec 2022 17:18:56 +0200 Subject: [PATCH 4/6] github/push-checks: set mypy-all script to be +x --- scripts/mypy-all.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/mypy-all.sh diff --git a/scripts/mypy-all.sh b/scripts/mypy-all.sh old mode 100644 new mode 100755 From 3d53b1a54d18b098e02642c83f60dbdeaa12f289 Mon Sep 17 00:00:00 2001 From: Athanasius <Athanasius@miggy.org> Date: Fri, 23 Dec 2022 15:24:45 +0000 Subject: [PATCH 5/6] github/mypy: Specifically run for win32 platform --- .github/workflows/push-checks.yml | 2 +- scripts/mypy-all.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push-checks.yml b/.github/workflows/push-checks.yml index b483ebb0..07f45e75 100644 --- a/.github/workflows/push-checks.yml +++ b/.github/workflows/push-checks.yml @@ -67,4 +67,4 @@ jobs: - name: mypy type checks run: | - ./scripts/mypy-all.sh + ./scripts/mypy-all.sh --platform win32 diff --git a/scripts/mypy-all.sh b/scripts/mypy-all.sh index 71f2f958..02a76a48 100755 --- a/scripts/mypy-all.sh +++ b/scripts/mypy-all.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash # -mypy $(git ls-tree --full-tree -r --name-only HEAD | grep -E '\.py$') +mypy $@ $(git ls-tree --full-tree -r --name-only HEAD | grep -E '\.py$') From db956cd68b5ea162c40e26562aafd66534c36fe9 Mon Sep 17 00:00:00 2001 From: Athanasius <Athanasius@miggy.org> Date: Fri, 23 Dec 2022 15:32:09 +0000 Subject: [PATCH 6/6] scripts/mypy-all: Add a little comment documentation --- scripts/mypy-all.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/mypy-all.sh b/scripts/mypy-all.sh index 02a76a48..72a37f0b 100755 --- a/scripts/mypy-all.sh +++ b/scripts/mypy-all.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash # +# Run mypy checks against all the relevant files +# We assume that all `.py` files in git should be checked, and *only* those. mypy $@ $(git ls-tree --full-tree -r --name-only HEAD | grep -E '\.py$')