fixing test case #1
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: ci-cd | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/ci-cd.yaml | |
- src/** | |
- tests/** | |
release: | |
types: | |
- published | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
check-quality: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: install-dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install ".[quality]" | |
- name: check-quality | |
run: | | |
black --check --diff --preview src tests | |
ruff src tests | |
mypy src | |
run-tests: | |
needs: check-quality | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: install-dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install ".[tests]" | |
- name: run-tests | |
run: pytest --cov=product-fun --cov-report=term-missing tests/ -s --durations 0 | |
deploy-docs: | |
needs: run-tests | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: install-dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[docs]" | |
- name: deploy-to-gh-pages | |
run: mkdocs gh-deploy --force | |
publish-package: | |
needs: deploy-docs | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: install-dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install hatch | |
- name: build-package | |
run: hatch build | |
- name: publish-package | |
run: hatch publish --user __token__ --auth $PYPI_TOKEN | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |