Skip to content

Commit

Permalink
Merge pull request #661 from consideRatio/pr/misc-ci-updates-and-code…
Browse files Browse the repository at this point in the history
…cov-fix

ci: misc ci updates
  • Loading branch information
consideRatio committed Nov 1, 2022
2 parents f5d1b0b + f15a86d commit ca30403
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 61 deletions.
36 changes: 20 additions & 16 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,36 @@
#
name: Publish

# Trigger the workflow's on pushed version tags.
on:
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/publish.yaml"
push:
tags: "[0-9]+.[0-9]+.[0-9]+*"
paths-ignore:
- "docs/**"
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/publish.yaml"
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
workflow_dispatch:

jobs:
# Builds and pushes docker images to DockerHub and package the Helm chart and
# pushes it to jupyterhub/helm-chart@gh-pages where index.yaml represents the
# JupyterHub organization Helm chart repository.
#
# NOTE: Keep this job in sync with the build package test in test.yaml!
#
# ref: https://github.com/jupyterhub/helm-chart
# ref: https://hub.docker.com/orgs/jupyterhub
#
publish:
name: Publish to PyPI
runs-on: ubuntu-20.04
publish-to-pypi:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: "3.10"

- name: install build package
run: |
pip install --upgrade pip
pip install build
pip freeze
Expand All @@ -40,6 +43,7 @@ jobs:
# ref: https://github.com/pypa/gh-action-pypi-publish
- name: publish to pypi
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@v1.5.1
with:
user: __token__
Expand Down
40 changes: 6 additions & 34 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#
name: Test

# Trigger the workflow's on pushed branches, pull requests, and manually run
# workflows.
on:
pull_request:
paths-ignore:
Expand All @@ -25,8 +23,7 @@ on:

jobs:
run-pytest:
name: Run pytest
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 10

strategy:
Expand All @@ -51,11 +48,11 @@ jobs:
# Test with modern python and k8s versions
- python: "3.9"
k3s: stable
- python: "3.9"
- python: "3.10"
k3s: latest

# Test with latest python and JupyterHub in main branch
- python: "3.10"
- python: "3.11"
k3s: latest
test_dependencies: git+https://github.com/jupyterhub/jupyterhub

Expand All @@ -67,7 +64,6 @@ jobs:

- name: Install package and test dependencies
run: |
pip install --upgrade pip
pip install -e ".[test]" ${{ matrix.test_dependencies }}
pip freeze
Expand All @@ -85,36 +81,12 @@ jobs:

- name: Run pytest
run: |
pytest -v --durations 10 --cov kubespawner --color=yes
pytest --cov kubespawner
# ref: https://github.com/jupyterhub/action-k8s-namespace-report
- name: Kubernetes namespace report
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()

- name: Submit a codecov report
run: |
pip install codecov
codecov
# Keep this job synced with the publish job in publish.yaml!
package-build:
name: Test package build
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: install build package
run: |
pip install --upgrade pip
pip install build
pip freeze
- name: build release
run: |
python -m build --sdist --wheel .
ls -alh dist
# ref: https://github.com/codecov/codecov-action
- uses: codecov/codecov-action@v3
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ repos:
rev: 22.10.0
hooks:
- id: black
args: [--target-version=py37]

# Autoformat: markdown, yaml
- repo: https://github.com/pre-commit/mirrors-prettier
Expand Down
27 changes: 24 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tool.isort]
profile = "black"

# black is used for autoformatting Python code
#
# ref: https://black.readthedocs.io/en/stable/
#
[tool.black]
skip-string-normalization = true
# target-version should be all supported versions, see
Expand All @@ -10,4 +11,24 @@ target_version = [
"py38",
"py39",
"py310",
"py311",
]


# isort is used for autoformatting Python code
#
# ref: https://pycqa.github.io/isort/
#
[tool.isort]
profile = "black"


# pytest is used for running Python based tests
#
# ref: https://docs.pytest.org/en/stable/
#
[tool.pytest.ini_options]
addopts = "--verbose --color=yes --durations=10"
asyncio_mode = "auto"
# Ignore thousands of tests in dependencies installed in a virtual environment
norecursedirs = "lib lib64"
7 changes: 0 additions & 7 deletions setup.cfg

This file was deleted.

0 comments on commit ca30403

Please sign in to comment.