Skip to content

Update contributing docs #16

Update contributing docs

Update contributing docs #16

Workflow file for this run

# Run all CI checks on pushes to the main branch or pull-request updates.
#
# This includes: running static checks such as linting and type checking,
# running the test suite on all supported Python versions, and uploading
# coverage reports to Codecov and Codacy. Additionally, the Sphinx docs
# are built, and a link to the docs will be added to the PR description
#
name: CI checks
on:
push:
branches: [ main ]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
pull-requests: write
jobs:
# Build the docs and update the PR description w/ a link to readthedocs
# https://github.com/readthedocs/actions/tree/main/preview
documentation-links:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
timeout-minutes: 1
steps:
- uses: readthedocs/actions/preview@v1
with:
project-slug: "ridgeplot"
# Run static checks only for Ubuntu and Python 3.9
static-checks:
name: Static checks
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python
with:
python-version: "3.9"
requirements: tox
# Instead of running all checks in one task (i.e., `tox -m static`),
# we'll instead run them one-by-one, so that it's easier to
# identify and debug failing checks in the GitHub UI.
- name: Run static checks with pre-commit
shell: bash
env:
SKIP: "no-commit-to-branch"
run: tox -e pre-commit
- name: Run type checks with mypy
shell: bash
run: tox -e mypy
# Run test suits for all supported platforms and Python versions
software-tests:
name: Software tests
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
# There shouldn't be any behavior differences between OSes,
# so we'll only run the test suite on Ubuntu for now. Also,
# since I (the main maintainer) develop on a macOS machine,
# I will run all tests locally on macOS before merging any
# PRs or releasing new versions. This should be sufficient
# and will speed up the CI/CD process quite significantly.
# - macos-latest
# - windows-latest
fail-fast: true
runs-on: ${{ matrix.os }}
timeout-minutes: 8
steps:
- uses: actions/checkout@v4
with:
# TODO: This can be very expensive for large repos. Is there a better way to do this?
# Fetch all history and tags for setuptools_scm to work
fetch-depth: 0
- uses: ./.github/actions/setup-python
with:
python-version: "${{ matrix.python-version }}"
requirements: tox
# Instead of running all tests in one task (i.e., `tox -m tests`),
# we'll instead run them one-by-one, so that it's easier to
# identify and debug failing tests in the GitHub UI.
- name: Run unit tests
shell: bash
run: tox -e tests-unit
env:
DIFF_AGAINST: HEAD
- name: Run E2E tests
shell: bash
run: tox -e tests-e2e
env:
DIFF_AGAINST: HEAD
- name: Test the CI/CD utilities
shell: bash
run: tox -e tests-cicd_utils
env:
DIFF_AGAINST: HEAD
# Combine coverage reports from all test suites
- name: Combine coverage reports
shell: bash
run: tox -e coverage-combine
env:
DIFF_AGAINST: HEAD
# Upload coverage reports to Codecov and Codacy.
- name: Upload coverage to codecov
uses: codecov/codecov-action@v4
env:
OS: "${{ matrix.os }}"
PYTHON: "${{ matrix.python-version }}"
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.combined.src.xml
disable_search: true
flags: combined-src
env_vars: OS,PYTHON
fail_ci_if_error: true
verbose: true
- name: Upload coverage to codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.combined.src.xml