Skip to content

Commit

Permalink
Set up github action to run tests for this repo
Browse files Browse the repository at this point in the history
  • Loading branch information
lizgzil committed Sep 19, 2024
1 parent 26dac70 commit f45b571
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Unit Tests

on: [push]

jobs:
build:
runs-on: ${{ matrix.os.host }}
strategy:
matrix:
python-version: ["3.9", "3.10"]
os:
- name: ubuntu
host: ubuntu-latest
- name: windows
host: windows-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: (ubuntu) Install dependencies
if: runner.os != 'windows'
run: |
python -m pip install --upgrade pip
# For a normal project you would install the full requirements
# needed to run the tests
# pip install -r requirements.txt
pip install pytest
pip install -e ."[test]"
- name: (ubuntu) Test with pytest
if: runner.os != 'windows'
run: |
pytest --verbose
- name: (windows) Install dependencies
if: runner.os == 'windows'
shell: bash
run: |
python -m pip install --upgrade pip
# For a normal project you would install the full requirements
# needed to run the tests
# pip install -r requirements.txt
pip install pytest
pip install -e .
- name: (windows) Test with pytest
if: runner.os == 'windows'
shell: bash
run: |
pytest --verbose
8 changes: 8 additions & 0 deletions tests/test_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
This is an example of a test used to showcase how to set up github actions for testing.
"""

import pytest

def test_example():
assert 1 == 1

0 comments on commit f45b571

Please sign in to comment.