Skip to content

Commit 9efbafe

Browse files
committed
Add unit tests to build-and-publish workflow
- Add unit-tests job that runs before build-and-publish - Tests run on Ubuntu with Python 3.8 (same as build-and-test.yaml) - Add needs: unit-tests dependency to ensure tests pass before publishing - Prevents publishing broken code to PyPi - Tested locally: 287 tests pass successfully
1 parent 3ec74c3 commit 9efbafe

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/build-and-publish.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,32 @@ on:
1919
default: 'CRITICAL,HIGH'
2020

2121
jobs:
22+
unit-tests:
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
python-version: ["3.8"]
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
36+
- name: Install dependencies
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install -e .[dev]
40+
41+
- name: Run unit tests
42+
run: |
43+
python -m unittest tests/*.py
44+
2245
build-and-pubish:
2346
name: Build and publish Python packages to PyPi
47+
needs: unit-tests
2448
uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-pypi-versioned.yaml@v3
2549
with:
2650
release_type: ${{ inputs.release_type }}

0 commit comments

Comments
 (0)