Skip to content

Tests

Tests #2191

Workflow file for this run

name: Tests
on:
push:
branches: ["main"]
pull_request:
schedule:
- cron: "0 0 * * *"
defaults:
run:
shell: bash -eux {0}
env:
PYTHONDONTWRITEBYTECODE: 1
jobs:
lint:
name: Test Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Run Linters
run: |
hatch run typing:test
hatch run lint:build
pipx run interrogate -v jupyter_releaser
pipx run doc8 --max-line-length=200
check_links:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Run the tests with coverage on Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
hatch run cov:test -n auto --cov-fail-under 80 || hatch run test:test --lf
- name: Run the tests on Windows and MacOS
if: ${{ matrix.os != 'ubuntu-latest' }}
run: hatch run cov:test -s -n auto || hatch run cov:test -s --lf
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1
coverage:
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/report-coverage@v1
generate_changelog:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RH_REPOSITORY: jupyter-server/jupyter_releaser
RH_SINCE: v0.10.2
RH_UNTIL: v0.10.3
run: |
set -eux
pip install -e .
python -m jupyter_releaser.actions.generate_changelog
cat CHANGELOG_ENTRY.md
# Check for version entry contents
cat CHANGELOG_ENTRY.md | grep -q "#234"
cat CHANGELOG_ENTRY.md | grep -q "compare/${RH_SINCE}...${RH_UNTIL}"
# make sure it works with different settings
export RH_SINCE=
export RH_UNTIL=
export RH_CONVERT_TO_RST=true
sudo apt-get install pandoc
pip install pypandoc
python -m jupyter_releaser.actions.generate_changelog
cat CHANGELOG_ENTRY.md
test_minimum_versions:
name: Test Minimum Versions
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
dependency_type: pre
- name: Run the unit tests
run: |
hatch run test:nowarn || hatch run test:nowarn --lf
test_prereleases:
name: Test Prereleases
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
dependency_type: pre
- name: Run the tests
run: |
hatch run test:nowarn || hatch run test:nowarn --lf
docs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- run: hatch run docs:build
check_local_actions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: prep-release
uses: ./.github/actions/prep-release
with:
token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
- name: populate-release
uses: ./.github/actions/populate-release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release_url: ${{ steps.prep-release.outputs.release_url }}
dry_run: true
- name: publish-release
uses: ./.github/actions/finalize-release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release_url: ${{ steps.populate-release.outputs.release_url }}
dry_run: true
check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- check_links
- coverage
- docs
- lint
- check_local_actions
- test_minimum_versions
- test_prereleases
- generate_changelog
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}