Skip to content

Commit f030098

Browse files
committed
Add complete workflow file
1 parent f40160b commit f030098

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

learners/files/10-CI/tests.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This is just the name of the action, you can call it whatever you like.
2+
name: Tests (pytest)
3+
4+
# This sets the events that trigger the action. In this case, we are telling
5+
# GitHub to run the tests whenever a push is made to the repository.
6+
# The trailing colon is intentional!
7+
on:
8+
push:
9+
# Only check when Python files are changed.
10+
# Don't need to check when the README is updated!
11+
paths:
12+
- '**.py'
13+
- 'pyproject.toml'
14+
pull_request:
15+
paths:
16+
- '**.py'
17+
- 'pyproject.toml'
18+
# Only check when somebody raises a pull_request to main.
19+
branches: [main]
20+
# This allows you to run the tests manually if you choose
21+
workflow_dispatch:
22+
23+
24+
# This is a list of jobs that the action will run. In this case, we have only
25+
# one job called build.
26+
jobs:
27+
28+
build:
29+
30+
strategy:
31+
matrix:
32+
python_version: ["3.12", "3.13", "3.14"]
33+
os: ["ubuntu-latest", "windows-latest"]
34+
exclude:
35+
- os: "windows-latest"
36+
python_version: "3.12"
37+
- os: "windows-latest"
38+
python_version: "3.13"
39+
40+
# This is the environment that the job will run on.
41+
runs-on: ${{ matrix.os }}
42+
43+
# This is a list of steps that the job will run. Each step is a command
44+
# that will be executed on the environment.
45+
steps:
46+
47+
# This command tells GitHub to use a pre-built action. In this case, we
48+
# are using the actions/checkout action to check out the repository. This
49+
# just means that GitHub will clone this repository to the current
50+
# working directory.
51+
- uses: actions/checkout@v6
52+
53+
# This is the name of the step. This is just a label that will be
54+
# displayed in the GitHub UI.
55+
- name: Set up Python ${{ matrix.python_version }}
56+
# This command tells GitHub to use a pre-built action. In this case, we
57+
# are using the actions/setup-python action to set up Python 3.12.
58+
uses: actions/setup-python@v6
59+
with:
60+
python-version: ${{ matrix.python_version }}
61+
62+
# This step installs the dependencies for the project such as pytest,
63+
# numpy, pandas, etc using the requirements.txt file we created earlier.
64+
- name: Install dependencies
65+
run: |
66+
python -m pip install --upgrade pip
67+
pip install -r requirements.txt
68+
69+
# This step runs the tests using the pytest command.
70+
- name: Run tests
71+
run: |
72+
pytest

0 commit comments

Comments
 (0)