Skip to content

Commit

Permalink
ci: updated how to install and run poetry
Browse files Browse the repository at this point in the history
added ruff format check in noxfile.py
  • Loading branch information
lewoudar committed Nov 27, 2023
1 parent 2bb5d36 commit 34194d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
8 changes: 2 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,21 @@
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 +40,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 34194d2

Please sign in to comment.