Merge pull request #79 from noppanut15/feat/shearwater-scuba #200
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: deploy | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
jobs: | |
test: | |
name: Test depthviz-python | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: | |
- { "pythonVersion": "3.9" } | |
- { "pythonVersion": "3.10" } | |
- { "pythonVersion": "3.11" } | |
- { "pythonVersion": "3.12" } | |
poetry-version: ["1.8.5"] | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Set up Python 🐍 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.versions.pythonVersion }} | |
- name: Install Poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: ${{ matrix.poetry-version }} | |
- name: Install dependencies 📦 | |
run: | | |
python -m pip install poetry | |
poetry install --with dev | |
- name: Check types, syntax and duckstrings 🦆 | |
run: | | |
poetry run mypy . | |
poetry run ruff check . | |
poetry run interrogate --ignore-init-module --ignore-init-method --quiet --fail-under=100 . | |
- name: Test depthviz with coverage 🧪 | |
run: poetry run coverage run --source=depthviz -m pytest . && poetry run coverage lcov -o coverage.lcov --fail-under=100 | |
- name: Submit coverage report to Coveralls 📈 | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./coverage.lcov | |
flag-name: run-python-${{ matrix.versions.pythonVersion }} | |
parallel: true | |
finish: | |
needs: test | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true | |
build: | |
name: Build and Push depthviz to PyPI | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} | |
needs: test | |
env: | |
python-version: "3.10" | |
poetry-version: "1.8.5" | |
environment: | |
name: pypi | |
url: https://pypi.org/p/depthviz | |
permissions: | |
id-token: write # This permission is mandatory for trusted publishing on PyPI | |
contents: write # This permission is for publishing the release on GitHub | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Set up Python 🐍 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.python-version }} | |
- name: Install Poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: ${{ env.poetry-version }} | |
- name: Install dependencies 📦 | |
run: | | |
python -m pip install poetry | |
poetry install --with dev | |
poetry self add "poetry-dynamic-versioning[plugin]" | |
- name: Generate CycloneDX SBOM artifacts 📃 | |
run: | | |
poetry run cyclonedx-py poetry --without dev --all-extras --of JSON -o depthviz-${{ github.ref_name }}.cyclonedx.json | |
- name: Build the package 📦 | |
run: | | |
poetry build | |
- name: Publish the package to PyPI 🎉 | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Create release and add artifacts 🚀 | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
dist/*.tar.gz | |
dist/*.whl | |
depthviz-${{ github.ref_name }}.cyclonedx.json | |
draft: false | |
prerelease: ${{ startsWith(github.ref, 'refs/tags') && (contains(github.ref_name, 'dev') || contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc')) }} | |
tag_name: ${{ github.ref_name }} | |
name: ${{ github.ref_name }} | |
generate_release_notes: true |