-
Notifications
You must be signed in to change notification settings - Fork 41
23 lines (20 loc) · 978 Bytes
/
python-unittest.yml
File metadata and controls
23 lines (20 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
name: Python unit tests
on: [push, pull_request] # Triggers the workflow on every push or pull request to any branch
jobs:
build:
runs-on: ubuntu-latest # Specifies the operating system to run the job on
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"] # Test across different Python versions
steps:
- uses: actions/checkout@v4 # Checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5 # Sets up a Python environment
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi # Installs any dependencies you have
- name: Test with unittest
run: python -m unittest discover # Runs the unittest discover command