Skip to content

Commit

Permalink
Test git release version
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickBaus committed Jan 31, 2024
1 parent 45a7b3b commit 1fff76f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
tests:
name: Run Python tests
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [ "3.12", ]

steps:
- name: Checkout source repository
uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
cache: 'pip' # caching pip dependencies
python-version: ${{ matrix.python-version }}
- name: Install dependencies for testing
run: |
python3 -m pip install --upgrade pip
python3 -m pip install .[test]
- name: Test with pytest
env:
GIT_TAG: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
run: |
pytest --exitfirst --verbose --failed-first
prepare:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -45,6 +71,7 @@ jobs:

build:
needs:
- tests
- prepare
runs-on: ubuntu-latest
permissions:
Expand Down
Empty file added tests/__init__.py
Empty file.
14 changes: 14 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Test to catch invalid versions when releasing a new git tag"""
import os

from _version import __version__


def test_version():
"""
Test the Git tag when using CI against the package version
"""
if os.getenv("GIT_TAG"):
assert os.getenv("GIT_TAG") == __version__
else:
assert True

0 comments on commit 1fff76f

Please sign in to comment.