diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94345da4..81f8bf08 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,21 @@ jobs: environment: name: pypi url: https://pypi.org/p/gpt-all-star - permissions: + unit-tests: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: poetry install + + - name: Run unit tests + run: pytest tests/ permissions: id-token: write steps: - uses: actions/download-artifact@v4 diff --git a/tests/test_release.py b/tests/test_release.py new file mode 100644 index 00000000..f7c01ff1 --- /dev/null +++ b/tests/test_release.py @@ -0,0 +1,54 @@ +import pytest + +from .github.workflows.release import build, publish + + +# Test cases for the build job +def test_build_job(): + # Test case 1: Test build job with Python 3.10 + # Set up the test environment + # ... + + # Execute the build job + build() + + # Assert the expected results + # ... + + # Test case 2: Test build job with another Python version + # Set up the test environment + # ... + + # Execute the build job + build() + + # Assert the expected results + # ... + + +# Test cases for the publish job +def test_publish_job(): + # Test case 1: Test publish job with a valid package + # Set up the test environment + # ... + + # Execute the publish job + publish() + + # Assert the expected results + # ... + + # Test case 2: Test publish job with an invalid package + # Set up the test environment + # ... + + # Execute the publish job + publish() + + # Assert the expected results + # ... + + +# Run the unit tests +if __name__ == "__main__": + pytest.main()