Skip to content

Commit

Permalink
CI Cleanup (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Nov 19, 2022
1 parent 00771c1 commit 5f2128b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 47 deletions.
61 changes: 25 additions & 36 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,31 @@ jobs:
test:
name: ${{ matrix.os }} ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
env:
CI: True
CODECOV_TOKEN: e025254a-fe54-4914-8890-0c26e7aa0d07
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.10"]
python-version: ["3.7", "3.11"]
include:
- os: windows-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "pypy-3.7"
python-version: "pypy-3.8"
- os: ubuntu-latest
python-version: "3.11"
python-version: "3.10"
- os: macos-latest
python-version: "3.8"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install project dependencies
run: |
pip install -e ".[test]"
- name: Run the tests
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(matrix.os, 'windows') }}
run: |
hatch run cov:test || hatch run test:test --lf
- name: Run the tests on pypy and windows
if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(matrix.os, 'windows') }}
run: |
hatch run test:test || hatch run test:test --lf
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: hatch run cov:test
- name: Run the tests on pypy
if: ${{ startsWith(matrix.python-version, 'pypy') }}
run: hatch run cov:nowarn
- name: Upload coverage
run: |
pip install codecov
Expand Down Expand Up @@ -84,39 +76,36 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

test_miniumum_verisons:
test_miniumum_versions:
name: Test Minimum Versions
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.8"
- uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
with:
python_version: "3.7"
- name: Install miniumum versions
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
only_create_file: 1
- name: Run the unit tests
run: pytest -vv -W default || pytest -vv -W default --lf
run: |
export PIP_CONSTRAINT="./contraints_file.txt"
hatch run test:nowarn || hatch run test:nowarn --lf
test_prereleases:
name: Test Prereleases
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install the Python dependencies
run: |
pip install --pre -e ".[test]"
- name: List installed packages
run: |
pip freeze
pip check
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.11"
- name: Run the tests
run: pytest -W default || pytest -W default --lf
run: |
export PIP_PRE=1
hatch run test:nowarn || hatch run test:nowarn --lf
make_sdist:
name: Make SDist
Expand Down Expand Up @@ -158,7 +147,7 @@ jobs:
- check_links
- docs
- check_release
- test_miniumum_verisons
- test_miniumum_versions
- test_prereleases
- test_sdist
runs-on: ubuntu-latest
Expand Down
9 changes: 2 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ repos:
["flake8-bugbear==22.6.22", "flake8-implicit-str-concat==0.2.0"]
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.19.1
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
stages: [manual]
- id: check-github-workflows
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage:
status:
project:
default:
target: auto
threshold: 1
patch:
default:
target: 0%
21 changes: 17 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,14 @@ build = "make -C docs html SPHINXOPTS='-W'"
features = ["test"]
[tool.hatch.envs.test.scripts]
test = "python -m pytest -vv {args}"
nowarn = "python -m pytest -vv -W default {args}"
nowarn = "test -W default {args}"

[tool.hatch.envs.cov]
features = ["test"]
dependencies = ["coverage", "pytest-cov"]
[tool.hatch.envs.cov.env-vars]
ARGS = "-vv --cov jupyterlab_server --cov-branch --cov-report term-missing:skip-covered"
[tool.hatch.envs.cov.scripts]
test = "python -m pytest $ARGS --cov-fail-under 80 {args}"
test = "python -m pytest -vv --cov jupyterlab_server --cov-branch --cov-report term-missing:skip-covered {args}"
nowarn = "test -W default {args}"

[tool.pytest.ini_options]
addopts = "-raXs --durations 10 --color=yes --doctest-modules"
Expand All @@ -119,6 +118,20 @@ filterwarnings = [
"module:Subclassing validator classes is not intended to be part of their public API:DeprecationWarning"
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]

[tool.flake8]
ignore = "E501, W503, E402"
builtins = "c, get_config"
Expand Down

0 comments on commit 5f2128b

Please sign in to comment.