From 42c8e21444c836937c2ba9c0a68acac5399cca3e Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 16 Jul 2025 09:40:13 -0300 Subject: [PATCH] [Tests][Added] GitHub workflow --- .github/workflows/python-tests.yml | 53 ++++++++++++++++++++++++++++++ source/requirements-dev.txt | 4 +++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/python-tests.yml create mode 100644 source/requirements-dev.txt diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml new file mode 100644 index 0000000..f5106cd --- /dev/null +++ b/.github/workflows/python-tests.yml @@ -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 \ No newline at end of file diff --git a/source/requirements-dev.txt b/source/requirements-dev.txt new file mode 100644 index 0000000..64a8fd1 --- /dev/null +++ b/source/requirements-dev.txt @@ -0,0 +1,4 @@ +pytest +# mypy +# flake8 +# Note: torch and torchaudio are handled separately in the workflow for CPU installation. \ No newline at end of file