Skip to content

Update README.md

Update README.md #259

Workflow file for this run

name: Unit Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
concurrency:
group: pages
cancel-in-progress: false
env:
DO_NOT_TRACK: 1
jobs:
build:
runs-on: ubuntu-latest
environment: test
continue-on-error: ${{ contains(matrix.python-version, 'pypy') }}
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install --system -e '.[dev,docs]'
- name: Write karate_club.tsv
run: python3 -c 'import networkx as nx; nx.write_weighted_edgelist(nx.karate_club_graph(), "karate_club.tsv", delimiter="\t")'
- name: Lint with Mypy
run: mypy chinese_whispers
- name: Lint with Ruff
run: ruff check
- name: Test with unittest
run: python3 -m unittest discover
- name: Run Module
run: python3 -m chinese_whispers karate_club.tsv
- name: Run CLI
run: chinese-whispers karate_club.tsv
- name: Lint Jupyter with Mypy
run: nbqa mypy *.ipynb
- name: Lint Jupyter with Ruff
run: nbqa ruff *.ipynb
- name: Run Jupyter
run: |
mkdir jupyter
jupyter nbconvert --to html --output jupyter/index.html --execute example.ipynb
- name: Run MkDocs
run: mkdocs build --strict
- name: Build
run: |
python3 -m build --sdist --wheel .
twine check --strict dist/*
- name: Validate CITATION.cff
uses: citation-file-format/[email protected]
with:
args: "--validate"
- name: Upload Jupyter
uses: actions/upload-pages-artifact@v3
with:
path: "./jupyter"
if: matrix.python-version == '3.12' && github.ref == 'refs/heads/master'
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: packages
path: dist/
if: matrix.python-version == '3.12' && github.ref == 'refs/heads/master'
pypi:
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
environment:
name: pypi
url: https://test.pypi.org/p/chinese-whispers
permissions:
id-token: write
runs-on: ubuntu-latest
needs: build
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
name: packages
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
pages:
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
actions: read
id-token: write
pages: write
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4