Skip to content

Commit 8561add

Browse files
ci: add pr.md explaining CI
1 parent 1987a19 commit 8561add

File tree

3 files changed

+73
-60
lines changed

3 files changed

+73
-60
lines changed

.github/workflows/documentation.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/pr.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Pull Request Automation Workflow
2+
Whenever a pull request is opened a number of automated checks are run to ensure breaking changes are not introduced and to ensure consistency of style and formatting.
3+
4+
These checks are defined by the `.github/workflows/pr.yml` file and this documentation is defined by `.github/workflows/pr.md`.
5+
6+
If you encounter any issues, reading the error messages and trying to reproduce them locally is a good first step.
7+
Don't hesitate to ask for assistance in the pull request or join the Discord server.
8+
9+
## Check Code
10+
11+
This job runs formatting, linting, tests, doctests, and checks notebooks.
12+
13+
<!-- TODO: update this link to the capymoa website after next deployment -->
14+
- If "**Formatting**" or "**Linting**" step fail the [Linting and Formatting guide](https://github.com/adaptive-machine-learning/CapyMOA/blob/main/docs/contributing/vcs.md#linting-and-formatting) may help.
15+
- If "**Tests and Doctests**" step fails the [Adding Tests guide](https://capymoa.org/contributing/tests.html) may help.
16+
- If "**Check Notebooks**" step fail the [Notebooks guide](https://capymoa.org/contributing/docs.html#notebooks) may help.
17+
18+
## Check Commit
19+
20+
This job checks if commit messages are conventional commit compliant. If these checks fail, the [Commit Messages guide](https://capymoa.org/contributing/vcs.html#commit-messages) may help. **Don't worry too much about this check, as the reviewer can assist by squashing and merging commits with a compliant message.**
21+
22+
## Check Documentation
23+
24+
This job ensures that the documentation can be built successfully. If this check fails, the [Documentation guide](https://capymoa.org/contributing/docs.html) may help.

.github/workflows/pr.yml

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
33

4-
# TODO: In the future we ought to perform linting and code coverage checks
4+
# TODO: In the future we ought to perform code coverage checks
55

66
name: Pull Request
77

@@ -19,58 +19,81 @@ permissions:
1919
contents: read
2020
pull-requests: read
2121

22+
env:
23+
PYTHON_VERSION: "3.10"
24+
2225
jobs:
23-
codeql:
24-
name: "Code Quality Analysis"
26+
code:
27+
name: "Check Code"
2528
timeout-minutes: 20
2629
runs-on: ubuntu-latest
27-
steps:
28-
- uses: actions/checkout@v3
29-
- name: Formatting `ruff format`
30-
uses: astral-sh/ruff-action@v3
31-
with:
32-
args: "format --check"
33-
- name: Linting `ruff check`
34-
uses: astral-sh/ruff-action@v3
35-
36-
tests:
37-
timeout-minutes: 20
38-
runs-on: ${{ matrix.operating-system }}
39-
needs: [codeql]
4030
strategy:
4131
fail-fast: true
42-
matrix:
43-
include:
44-
- python-version: "3.10"
45-
operating-system: ubuntu-latest
4632

4733
steps:
4834
- uses: actions/checkout@v3
49-
- name: Set up Python ${{ matrix.python-version }}
35+
36+
- name: Add Job Summary
37+
run: cat .github/workflows/pr.md >$GITHUB_STEP_SUMMARY
38+
39+
- name: Set up Python ${{ env.PYTHON_VERSION }}
5040
uses: actions/setup-python@v5
5141
with:
52-
python-version: ${{ matrix.python-version }}
42+
python-version: ${{ env.PYTHON_VERSION }}
5343
cache: 'pip' # caching pip dependencies
44+
45+
- name: Formatting
46+
uses: astral-sh/ruff-action@v3
47+
with:
48+
args: "format --check"
49+
50+
- name: Linting
51+
uses: astral-sh/ruff-action@v3
52+
5453
- name: Install dependencies
5554
run: |
5655
python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
5756
python -m pip install ".[dev]"
57+
5858
- name: Cache Test Datasets
5959
id: cache-test-datasets
6060
uses: actions/cache@v4
6161
with:
6262
path: data
6363
key: "test-datasets"
64-
- name: PyTest
64+
65+
- name: Tests and Doctests
6566
run: invoke test.unit
66-
- name: Notebooks
67+
68+
- name: Check Notebooks
6769
run: invoke test.nb
6870

69-
commitlint:
70-
name: "Conventional Commit Compliance"
71+
commit:
72+
name: "Check Commit"
7173
runs-on: ubuntu-latest
7274
steps:
7375
- uses: actions/checkout@v4
7476
with:
7577
fetch-depth: 0
7678
- uses: wagoid/commitlint-github-action@v6
79+
80+
documentation:
81+
name: "Check Documentation"
82+
timeout-minutes: 10
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v3
86+
- name: Set up Python
87+
uses: actions/setup-python@v5
88+
with:
89+
python-version: ${{ env.PYTHON_VERSION }}
90+
cache: 'pip' # caching pip dependencies
91+
- name: Install Dependencies
92+
run: |
93+
sudo apt-get install -y pandoc
94+
python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
95+
python -m pip install ".[dev,doc]"
96+
- name: Documentation Coverage Report
97+
run: invoke docs.coverage
98+
- name: Build Documentation
99+
run: invoke docs.build

0 commit comments

Comments
 (0)