ci: echo semantic release results #17
Workflow file for this run
This file contains 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: tenops (tensor operations) | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Set up python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "poetry" | |
- name: Install dependencies | |
run: poetry install | |
- name: Run tests | |
run: | | |
poetry run coverage run -m pytest -v | |
poetry run coverage report | |
poetry run coverage html | |
- name: Achive code coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: htmlcov | |
release: | |
needs: test | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Run semantic release | |
uses: python-semantic-release/python-semantic-release@master | |
id: semantic | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Semantic release results | |
run: echo "semantic release - ${{ steps.semantic.outputs.released }}" | |
- name: Build package | |
if: steps.semantic.outputs.released == 'true' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
poetry build | |
- name: Publish to TestPyPI | |
if: steps.semantic.outputs.released == 'true' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish to PyPI | |
if: steps.semantic.outputs.released == 'true' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |