[Tests][Added] GitHub workflow

This commit is contained in:
Salvador E. Tropea
2025-07-16 09:40:13 -03:00
parent 400d4f6caf
commit 42c8e21444
2 changed files with 57 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
# .github/workflows/python-tests.yml
name: Python Regression Tests
# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the main branch
push:
branches: [ "main", "dev" ] # Adjust to your main branches
# Triggers the workflow on pull request events to the main branch
pull_request:
branches: [ "main", "dev" ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# We can test against multiple Python versions
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"] # Specify Python versions you want to support
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# 1. Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v4
# 2. Sets up the specified version of Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# 3. Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install PyTorch for CPU first. This is crucial for non-GPU runners.
# We get the corresponding torch/torchaudio CPU URLs from pytorch.org.
# This command is for PyTorch 2.2.1 on Linux. Adjust if needed.
pip install torch==2.2.1+cpu torchaudio==2.2.1+cpu --index-url https://download.pytorch.org/whl/cpu
# Check for a requirements-dev.txt file in the src directory
if [ -f source/requirements-dev.txt ]; then pip install -r source/requirements-dev.txt; fi
# 4. Run tests using the Makefile
# We specify the working directory for the `make` command.
- name: Run tests with pytest via Makefile
working-directory: ./source
run: make test
+4
View File
@@ -0,0 +1,4 @@
pytest
# mypy
# flake8
# Note: torch and torchaudio are handled separately in the workflow for CPU installation.