Skip to content

Commit 98004ab

Browse files
authored
CI Cleanup (#462)
1 parent b62c9ca commit 98004ab

File tree

5 files changed

+69
-41
lines changed

5 files changed

+69
-41
lines changed

.github/workflows/test.yml

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,14 @@ env:
1212
PYTHONDONTWRITEBYTECODE: 1
1313

1414
jobs:
15-
# Run "pre-commit run --all-files --hook-stage=manual"
16-
pre-commit:
17-
runs-on: ubuntu-20.04
18-
timeout-minutes: 5
15+
pre_commit:
16+
runs-on: ubuntu-latest
1917
steps:
20-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
2119
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
22-
- uses: pre-commit/[email protected]
23-
with:
24-
extra_args: --all-files --hook-stage=manual
25-
- name: Help message if pre-commit fail
26-
if: ${{ failure() }}
27-
run: |
28-
echo "You can install pre-commit hooks to automatically run formatting"
29-
echo "on each commit with:"
30-
echo " pre-commit install"
31-
echo "or you can run by hand on staged files with"
32-
echo " pre-commit run"
33-
echo "or after-the-fact on already committed files with"
34-
echo " pre-commit run --all-files --hook-stage=manual"
35-
36-
check-links:
20+
- uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1
21+
22+
check_links:
3723
runs-on: ubuntu-20.04
3824
steps:
3925
- uses: actions/checkout@v2
@@ -54,15 +40,15 @@ jobs:
5440
- name: Run the tests with coverage on Ubuntu
5541
if: ${{ matrix.os == 'ubuntu-latest' }}
5642
run: |
57-
hatch run cov:test -n auto || hatch run test:test --lf
43+
hatch run cov:test -n auto --cov-fail-under 80 || hatch run test:test --lf
5844
pip install codecov
5945
codecov
6046
6147
- name: Run the tests on Windows and MacOS
6248
if: ${{ matrix.os != 'ubuntu-latest' }}
63-
run: hatch run test:test -s -n auto || hatch run test:test -s --lf
49+
run: hatch run cov:test -s -n auto || hatch run cov:test -s --lf
6450

65-
generate-changelog:
51+
generate_changelog:
6652
runs-on: ubuntu-20.04
6753
timeout-minutes: 10
6854
steps:
@@ -90,6 +76,37 @@ jobs:
9076
python -m jupyter_releaser.actions.generate-changelog
9177
cat CHANGELOG_ENTRY.md
9278
79+
test_minimum_versions:
80+
name: Test Minimum Versions
81+
timeout-minutes: 20
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v3
85+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
86+
with:
87+
python_version: "3.8"
88+
- uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
89+
with:
90+
only_create_file: 1
91+
- name: Run the unit tests
92+
run: |
93+
export PIP_CONSTRAINT="./contraints_file.txt"
94+
hatch run test:nowarn || hatch run test:nowarn --lf
95+
96+
test_prereleases:
97+
name: Test Prereleases
98+
runs-on: ubuntu-latest
99+
timeout-minutes: 20
100+
steps:
101+
- uses: actions/checkout@v3
102+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
103+
with:
104+
python_version: "3.11"
105+
- name: Run the tests
106+
run: |
107+
export PIP_PRE=1
108+
hatch run test:nowarn || hatch run test:nowarn --lf
109+
93110
docs:
94111
runs-on: ubuntu-20.04
95112
timeout-minutes: 10
@@ -127,12 +144,14 @@ jobs:
127144
check: # This job does nothing and is only used for the branch protection
128145
if: always()
129146
needs:
130-
- check-links
147+
- check_links
131148
- test
132149
- docs
133-
- pre-commit
150+
- pre_commit
134151
- check_local_actions
135-
- generate-changelog
152+
- test_minimum_versions
153+
- test_prereleases
154+
- generate_changelog
136155
runs-on: ubuntu-latest
137156
steps:
138157
- name: Decide whether the needed jobs succeeded or failed

.pre-commit-config.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,18 @@ repos:
7272
]
7373
stages: [manual]
7474

75-
- repo: https://github.com/sirosen/check-jsonschema
75+
- repo: https://github.com/python-jsonschema/check-jsonschema
7676
rev: 0.19.1
7777
hooks:
78-
- id: check-jsonschema
78+
- id: check-github-workflows
7979
name: "Check GitHub Workflows"
8080
files: ^\.github/workflows/
8181
types: [yaml]
82-
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
83-
stages: [manual]
8482

85-
- repo: https://github.com/sirosen/check-jsonschema
83+
- repo: https://github.com/python-jsonschema/check-jsonschema
8684
rev: 0.19.1
8785
hooks:
88-
- id: check-jsonschema
86+
- id: check-github-workflows
8987
name: "Check Example Workflows"
9088
files: ^example-workflows/
9189
types: [yaml]
92-
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
93-
stages: [manual]

codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ coverage:
33
project:
44
default:
55
target: auto
6-
threshold: 10
6+
threshold: 1
77
patch:
88
default:
99
target: 0%

jupyter_releaser/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def github_port(worker_id):
2929
@fixture(autouse=True)
3030
def mock_env(mocker):
3131
"""Clear unwanted environment variables"""
32-
# Anything that starts with RH_ or GITHUB_
33-
prefixes = ["GITHUB_", "RH_"]
32+
# Anything that starts with RH_ or GITHUB_ or PIP
33+
prefixes = ["GITHUB_", "RH_", "PIP_"]
3434
env = os.environ.copy()
3535
for key in list(env):
3636
for prefix in prefixes:

pyproject.toml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,14 @@ build = "make -C docs html SPHINXOPTS='-W'"
7979
features = ["test"]
8080
[tool.hatch.envs.test.scripts]
8181
test = "python -m pytest -vv {args}"
82-
nowarn = "python -m pytest -vv -W default {args}"
82+
nowarn = "test -W default {args}"
8383

8484
[tool.hatch.envs.cov]
8585
features = ["test"]
8686
dependencies = ["coverage", "pytest-cov"]
87-
[tool.hatch.envs.cov.env-vars]
88-
ARGS = "-vv --cov jupyter_releaser --cov-branch --cov-report term-missing:skip-covered"
8987
[tool.hatch.envs.cov.scripts]
90-
test = "python -m pytest $ARGS --cov-fail-under 80 {args}"
88+
test = "python -m pytest -vv --cov jupyter_releaser --cov-branch --cov-report term-missing:skip-covered {args}"
89+
nowarn = "test -W default {args}"
9190

9291
[tool.jupyter-releaser.hooks]
9392
after-populate-release = "bash ./.github/scripts/bump_tag.sh"
@@ -107,6 +106,20 @@ filterwarnings= [
107106
"module:Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found:UserWarning",
108107
]
109108

109+
[tool.coverage.report]
110+
exclude_lines = [
111+
"pragma: no cover",
112+
"def __repr__",
113+
"if self.debug:",
114+
"if settings.DEBUG",
115+
"raise AssertionError",
116+
"raise NotImplementedError",
117+
"if 0:",
118+
"if __name__ == .__main__.:",
119+
"class .*\bProtocol\\):",
120+
"@(abc\\.)?abstractmethod",
121+
]
122+
110123
[tool.mypy]
111124
check_untyped_defs = true
112125
disallow_any_generics = false

0 commit comments

Comments
 (0)