Skip to content

Commit

Permalink
Merge pull request #124 from ekiefl/improve-installation
Browse files Browse the repository at this point in the history
Use poetry
  • Loading branch information
ekiefl authored Jul 22, 2024
2 parents 8f66cc8 + 01dcae3 commit c696a12
Show file tree
Hide file tree
Showing 22 changed files with 2,290 additions and 331 deletions.
5 changes: 5 additions & 0 deletions .env.copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# API token for the PyPI prod server.
POETRY_PYPI_TOKEN_PYPI=

# API token for the PyPI test server.
POETRY_PYPI_TOKEN_PYPI_TEST=
118 changes: 0 additions & 118 deletions .github/workflows/ci.yml

This file was deleted.

135 changes: 135 additions & 0 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: lint-and-test

on:
pull_request:
branches: [main]

jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Cache Poetry install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-1.8.3-0

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: true

- name: Cache Poetry dependencies
id: cache-poetry-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

- run: poetry install --no-interaction --no-root
if: steps.cache-poetry-deps.outputs.cache-hit != 'true'

# --- Ruff

- name: ruff (lint)
id: ruff_lint
continue-on-error: true
run: |
poetry run ruff --version
poetry run ruff check . --verbose --diff
echo "ruff_lint_failed=$?" >> $GITHUB_ENV
- name: ruff (format)
id: ruff_format
continue-on-error: true
run: |
poetry run ruff --version
poetry run ruff format . --check --verbose --diff
echo "ruff_format_failed=$?" >> $GITHUB_ENV
# --- Pytest

- name: pytest
id: pytest
continue-on-error: true
run: |
poetry run pytest --version
poetry run pytest
echo "pytest_failed=$?" >> $GITHUB_ENV
# --- Pyright

- name: pyright
id: pyright
continue-on-error: true
run: |
poetry run pyright --version
poetry run pyright --project ./pyrightconfig.ci.json
echo "pyright_failed=$?" >> $GITHUB_ENV
# --- Main

- name: Test results
if: always()
run: |
# Print out test results
passed=()
failed=()
if [[ "${{ env.pytest_failed }}" != "0" ]]; then
failed+=("pytest")
else
passed+=("pytest")
fi
if [[ "${{ env.pyright_failed }}" != "0" ]]; then
failed+=("pyright")
else
passed+=("pyright")
fi
if [[ "${{ env.ruff_lint_failed }}" != "0" ]]; then
failed+=("ruff_lint")
else
passed+=("ruff_lint")
fi
if [[ "${{ env.ruff_format_failed }}" != "0" ]]; then
failed+=("ruff_format")
else
passed+=("ruff_format")
fi
if [ ${#passed[@]} -ne 0 ]; then
echo "✅ PASSED:"
for check in "${passed[@]}"; do
echo " - $check"
done
fi
echo ""
if [ ${#failed[@]} -ne 0 ]; then
echo "❌ FAILED:"
for check in "${failed[@]}"; do
echo " - $check"
done
else
echo "🚀🚀 ALL TESTS PASSED 🚀🚀"
fi
echo ""
echo "Click above jobs for details on each success/failure"
if [ ${#failed[@]} -ne 0 ]; then
exit 1
fi
16 changes: 7 additions & 9 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ build:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- python -m pip install poetry
post_install:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs

# Build documentation in the "docs/" directory with Sphinx
sphinx:
Expand All @@ -26,12 +33,3 @@ sphinx:
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt
- requirements: requirements-dev.txt
18 changes: 0 additions & 18 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit c696a12

Please sign in to comment.