update #85
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| branches: | |
| - '**' # Run on all branches for push | |
| jobs: | |
| run-unit-tests: | |
| strategy: | |
| matrix: | |
| python-version: ['3.9', '3.10', '3.11', '3.12'] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| - name: Setup Python | |
| uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Upgrade pip, setuptools, wheel | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| - name: Install Poetry | |
| uses: abatilo/actions-poetry@0dd19c9498c3dc8728967849d0d2eae428a8a3d8 # v4 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| - name: Install dependencies | |
| run: | | |
| poetry install --no-interaction --no-ansi --no-root | |
| - name: Check installed packages (debug) | |
| run: | | |
| poetry run pip list | |
| poetry run pip show setuptools | |
| - uses: actions/cache@v3 | |
| name: Define a cache for the virtual environment based on the dependencies lock file | |
| with: | |
| path: ./.venv | |
| key: venv-${{ hashFiles('poetry.lock') }} | |
| - name: Run Unit Tests | |
| run: | | |
| mkdir test-results | |
| poetry run python -m pytest --junitxml=test-results/junit.xml -v tests -W ignore::DeprecationWarning | |
| - name: Upload test results | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| with: | |
| name: test-results-${{ matrix.python-version }} | |
| path: test-results | |
| verify: | |
| if: github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| - name: Verify | |
| run: | | |
| ./verify.sh | |
| publish-to-test-pypi: | |
| if: github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| - name: Set up Python | |
| uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| with: | |
| python-version: '3.12' | |
| - name: Install Poetry | |
| uses: abatilo/actions-poetry@0dd19c9498c3dc8728967849d0d2eae428a8a3d8 # v4 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| - name: Install dependencies | |
| run: | | |
| poetry install --no-interaction --no-ansi --no-root | |
| - name: Build package | |
| run: | | |
| poetry build | |
| - name: Publish to Test PyPI | |
| env: | |
| PYPI_TEST_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }} | |
| run: | | |
| poetry config repositories.testpypi https://test.pypi.org/legacy/ | |
| poetry publish -u __token__ -p $PYPI_TEST_TOKEN -r testpypi | |
| publish-to-pypi: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| - name: Set up Python | |
| uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| with: | |
| python-version: '3.12' | |
| - name: Install Poetry | |
| uses: abatilo/actions-poetry@0dd19c9498c3dc8728967849d0d2eae428a8a3d8 # v4 Uses a commit SHA instead of a tag for deterministic builds—update the SHA to bump version. | |
| - name: Install dependencies | |
| run: | | |
| poetry install --no-interaction --no-ansi --no-root | |
| - name: Build package | |
| run: | | |
| poetry build | |
| - name: Publish to PyPI | |
| env: | |
| PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| run: | | |
| poetry publish -u __token__ -p $PYPI_TOKEN |