Skip to content

Commit 66527c5

Browse files
committed
Add CI task
1 parent ce2c068 commit 66527c5

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Continuous Integration
2+
3+
on:
4+
# Trigger the jobs on each push to main branch
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
ci-tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Install poetry
15+
run: pipx install poetry
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.x"
20+
cache: "poetry"
21+
- name: Install dependencies
22+
run: poetry install
23+
- name: Check the code
24+
run: poetry run pylint pytorch_tutorial/*
25+
- name: Run unit tests
26+
run: poetry run pytest

ABOUT.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ In my opinion, a true gem for learning PyTorch from scratch was the [PyTorch Tut
66

77
This project aims to follow a similar path by providing a set of bare-bones, self-sufficient, and beginner-friendly examples. They illustrate the core parts of PyTorch in a step-by-step fashion, from tensor manipulation to the training of Deep Learning models. They strive to keep up with API changes and follow good practices.
88

9-
Rather than Jupyter notebooks, these examples are provided as pure Python files because I think it facilitates a global understanding of their structure. It also simplifies [code formatting](https://github.com/psf/black), [linting](https://github.com/pylint-dev/pylint), and [testing](https://docs.pytest.org). All code examples are heavily commented and accompanied by README files for additional information.
9+
Rather than Jupyter notebooks, these examples are provided as standalone Python files for the following reasons:
10+
11+
- it facilitates a global understanding of their structure;
12+
- it simplifies [formatting](https://github.com/psf/black), [linting](https://github.com/pylint-dev/pylint), [testing](https://docs.pytest.org) and [continuous integration](.github/workflows/ci.yaml);
13+
- it promotes concision and general code quality.
14+
15+
All examples are heavily commented and accompanied by `README` files for an easier follow-through.
1016

1117
You are very welcome to contribute to the improvement of this project through [ideas](https://github.com/bpesquet/pytorch-tutorial/issues) or [corrections](https://github.com/bpesquet/pytorch-tutorial/pulls).
1218

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@ This project is built with the following software:
2828

2929
- [Poetry](https://python-poetry.org/) for dependency management;
3030
- [Black](https://github.com/psf/black) for code formatting;
31-
- [Pylint](https://github.com/pylint-dev/pylint) to detect mistakes in the code;
32-
- [pytest](https://docs.pytest.org) for testing the code;
33-
- [Marp](https://marp.app/) for showcasing Markdown files as slideshows during labs.
31+
- [Pylint](https://github.com/pylint-dev/pylint) to detect mistakes in the codebase;
32+
- [pytest](https://docs.pytest.org) for testing examples;
33+
- a [GitHub Action](.github/workflows/ci.yaml) for validating the code upon each push;
34+
- [Marp](https://marp.app/) for showcasing `README` files as slideshows during lectures or labs.
3435

3536
### Useful commands
3637

3738
```bash
3839
# Reformat all Python files
3940
black .
4041

41-
# Check the code for mistakes
42+
# Check the codebase for mistakes
4243
pylint pytorch_tutorial/*
4344

4445
# Run all code examples as unit tests

0 commit comments

Comments
 (0)