Skip to content

Commit

Permalink
ci: updated how to install and run poetry (#35)
Browse files Browse the repository at this point in the history
* ci: updated how to install and run poetry

added ruff format check in noxfile.py

* ci(noxfile): fixed lint session
  • Loading branch information
lewoudar committed Nov 27, 2023
1 parent 2bb5d36 commit 5453ce8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -21,8 +21,10 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install python dependencies
run: python -m pip install -U pip nox
- name: Install python pre-requisites
run: python -m pip install -U pip nox pipx
- name: Install poetry
run: pipx install "poetry<1.8.0"
- name: Lint
run: nox -s lint
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Expand Up @@ -16,8 +16,10 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install python dependencies
run: python -m pip install -U pip nox
- name: Install python pre-requisites
run: python -m pip install -U pip nox pipx
- name: Install poetry
run: pipx install "poetry<1.8.0"
- name: Build and deploy
run: nox -s deploy
env:
Expand Down
7 changes: 2 additions & 5 deletions noxfile.py
Expand Up @@ -13,24 +13,22 @@
def lint(session):
"""Performs pep8 and security checks."""
source_code = 'click_params'
session.install('poetry>=1.0.0,<1.5.0')
session.run('poetry', 'install', '--only', 'lint')
session.run('ruff', 'check', source_code)
session.run('ruff', 'format', '.')
session.run('bandit', '-r', source_code)


@nox.session(python=PYTHON_VERSIONS[-1])
def safety(session):
"""Checks vulnerabilities of the installed packages."""
session.install('poetry>=1.0.0,<1.5.0')
session.run('poetry', 'install', '--only', 'audit')
session.run('safety', 'check')


@nox.session(python=PYTHON_VERSIONS)
def tests(session):
"""Runs the test suite."""
session.install('poetry>=1.0.0,<1.5.0')
session.run('poetry', 'install', '--with', 'test')
session.run('pytest')

Expand All @@ -43,15 +41,14 @@ def docs(session):
session.run('mkdocs', 'build', '--clean')


@nox.session(python=PYTHON_VERSIONS[1])
@nox.session(python=False)
def deploy(session):
"""
Deploys on pypi.
"""
if 'POETRY_PYPI_TOKEN_PYPI' not in os.environ:
session.error('you must specify your pypi token api to deploy your package')

session.install('poetry>=1.0.0,<1.5.0')
session.run('poetry', 'publish', '--build')


Expand Down

0 comments on commit 5453ce8

Please sign in to comment.