changing versions of python and poetry #27
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: test-publish | |
# Run this workflow every time a new commit pushed to your repository | |
on: push | |
jobs: | |
test: | |
name: "test and lint" | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.1.1 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: restore dependencies from cache | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
run: poetry install | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Lint stylecheck with black | |
run: poetry run black --check begroing_index tests | |
- name: Stylecheck with pycodestyle | |
run: poetry run pycodestyle --config .pycodestyle begroing_index tests | |
- name: mypy type check | |
run: poetry run mypy begroing_index tests | |
- name: Run tests | |
run: poetry run pytest | |
- name: build | |
if: github.ref == 'refs/heads/main' | |
run: poetry build | |
- name: publish to pypi | |
if: github.ref == 'refs/heads/main' | |
run: poetry publish | |
env: | |
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.pypi_username }} | |
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.pypi_password }} | |