Skip to content

Commit

Permalink
ci: update ci files according to pymplate
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Aug 26, 2024
1 parent 9a0b01d commit b4bb205
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ jobs:

runs-on: ${{ matrix.platform }}

# useful for 'optional' pipelines
# continue-on-error: ${{ matrix.platform == 'windows-latest' }}

steps:
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # nicer to have all git history when debugging/for tests
Expand All @@ -51,7 +54,7 @@ jobs:
- run: bash .ci/run

- if: matrix.platform == 'ubuntu-latest' # no need to compute coverage for other platforms
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: .coverage.mypy_${{ matrix.platform }}_${{ matrix.python-version }}
path: .coverage.mypy/
Expand All @@ -65,11 +68,11 @@ jobs:
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
11 changes: 10 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# without it, pytest can't discover the package root for some reason
# also see https://github.com/karlicoss/pytest_namespace_pkgs for more

import os
import pathlib
from typing import Optional

Expand All @@ -24,6 +25,10 @@ def resolve_package_path(path: pathlib.Path) -> Optional[pathlib.Path]:
for parent in result.parents:
if str(parent) in namespace_pkg_dirs:
return parent
if os.name == 'nt':
# ??? for some reason on windows it is trying to call this against conftest? but not on linux/osx
if path.name == 'conftest.py':
return resolve_pkg_path_orig(path)
raise RuntimeError("Couldn't determine path for ", path)
_pytest.pathlib.resolve_package_path = resolve_package_path

Expand All @@ -34,5 +39,9 @@ def resolve_package_path(path: pathlib.Path) -> Optional[pathlib.Path]:
# not sure what are the consequences.. maybe it wouldn't be able to run against installed packages? not sure..
search_pypath_orig = _pytest.main.search_pypath
def search_pypath(module_name: str) -> str:
return str(root_dir)
mpath = root_dir / module_name.replace('.', os.sep)
if not mpath.is_dir():
mpath = mpath.with_suffix('.py')
assert mpath.exists(), mpath # just in case
return str(mpath)
_pytest.main.search_pypath = search_pypath
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ignore = [
lint.ignore = [
### too opinionated style checks
"E501", # too long lines
"E702", # Multiple statements on one line (semicolon)
Expand Down
2 changes: 1 addition & 1 deletion src/orger/modules/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from more_itertools import bucket

from my.core.common import asdict
from my.core.types import asdict


def pp_item(i, **kwargs) -> str:
Expand Down
13 changes: 7 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ passenv =
[testenv:ruff]
commands =
{envpython} -m pip install --use-pep517 -e .[testing]
{envpython} -m ruff src/
{envpython} -m ruff check src/


# note: --use-pep517 here is necessary for tox --parallel flag to work properly
Expand Down Expand Up @@ -54,11 +54,12 @@ commands =
commands =
{envpython} -m pip install --use-pep517 -e .[testing,optional]
{envpython} -m pip install HPI
{envpython} -m my.core module install my.pocket
{envpython} -m my.core module install my.reddit
{envpython} -m my.core module install my.instapaper
{envpython} -m my.core module install my.pinboard
{envpython} -m my.core module install my.kobo
{envpython} -m my.core module install \
my.pocket \
my.reddit \
my.instapaper \
my.pinboard \
my.kobo

{envpython} -m mypy --install-types --non-interactive \
-p {[testenv]package_name}.modules \
Expand Down

0 comments on commit b4bb205

Please sign in to comment.