Toreleon fix ci errors (#19) #24
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: Python CI | |
| on: | |
| push: | |
| branches: [ master, release ] | |
| pull_request: | |
| branches: [ release ] | |
| permissions: | |
| contents: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| python-version: ["3.12"] | |
| 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: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install poetry | |
| poetry install --all-extras | |
| - name: Run tests | |
| run: | | |
| poetry run pytest tests/ -v | |
| # Call the version-bump workflow to bump the version before publishing | |
| version-bump: | |
| needs: test | |
| uses: ./.github/workflows/version-bump.yml | |
| # Only run on release branch when push (merge) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/release' | |
| publish: | |
| needs: version-bump | |
| runs-on: ubuntu-latest | |
| # Only run on release branch when push (merge) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/release' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: 'refs/heads/release' | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install poetry | |
| - name: Fetch latest changes with updated version | |
| run: | | |
| git pull origin release # Make sure we have the latest version after bump | |
| - name: Build and publish | |
| env: | |
| PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| # Build the package using poetry | |
| poetry build | |
| # Publish to PyPI using poetry | |
| poetry config pypi-token.pypi $PYPI_API_TOKEN | |
| poetry publish |