chore: refactoring #53
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: build | |
on: | |
push: | |
# branches: [$default-branch] | |
branches: ["master"] | |
tags: ["*"] | |
pull_request: | |
# branches: [$default-branch] | |
branches: ["master"] | |
jobs: | |
# https://srz-zumix.blogspot.com/2019/10/github-actions-ci-skip.html | |
prepare: | |
runs-on: ubuntu-latest | |
if: "! contains(github.event.head_commit.message, '[skip ci]')" | |
steps: | |
- run: echo "[skip ci] ${{ contains(github.event.head_commit.message, '[skip ci]') }}" | |
- run: echo "[github.ref] ${{ github.ref }}" | |
build: | |
needs: ["prepare"] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry and codecov | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry codecov | |
- name: Install dependencies | |
run: | | |
poetry install --no-interaction | |
- name: Test with pytest | |
run: | | |
poetry run coverage run -m pytest -v | |
codecov | |
publish: | |
needs: ["build"] | |
if: "success() && startsWith(github.ref, 'refs/tags')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.x" | |
- name: Install poetry | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
- name: Build and publish package | |
run: | | |
poetry config pypi-token.pypi "${{ secrets.PYPI_API_TOKEN }}" | |
poetry publish --no-interaction --build |