Skip to content

Commit

Permalink
Rearrange tox environments and Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Jun 22, 2022
1 parent 8a5d64e commit 2239669
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 18 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
python -m pip install tox
- name: Build documentation
run: |
sphinx-build -a -b html -W --keep-going docs/ docs/_build
tox -e docs
14 changes: 11 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: pre-commit/action@v3.0.0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run linters
run: |
tox -e lint
9 changes: 5 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ jobs:
python-version: '3.10'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run tox
- name: Run tests
run: |
tox -e py
tox -e tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
`0.6.0`_ (2022-01-29)
=====================

- Remove internal use of ``pickle.loads()`` considered as a security vulnerability referenced as `CVE-2022-0329 <https://nvd.nist.gov/vuln/detail/CVE-2022-0329>`_ (`#563 <https://github.com/Delgan/loguru/issues/563>`_).
- Remove internal use of ``pickle.loads()`` to fix the (finally rejected) security vulnerability referenced as `CVE-2022-0329 <https://nvd.nist.gov/vuln/detail/CVE-2022-0329>`_ (`#563 <https://github.com/Delgan/loguru/issues/563>`_).
- Modify coroutine sink to make it discard log messages when ``loop=None`` and no event loop is running (due to internally using ``asyncio.get_running_loop()`` in place of ``asyncio.get_event_loop()``).
- Remove the possibility to add a coroutine sink with ``enqueue=True`` if ``loop=None`` and no event loop is running.
- Change default encoding of file sink to be ``utf8`` instead of ``locale.getpreferredencoding()`` (`#339 <https://github.com/Delgan/loguru/issues/339>`_).
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Prefer using a relatively recent Python version as some dependencies required fo

3. Activate your virtual environment::

$ python -m virtualenv env
$ python -m venv env
$ source env/bin/activate

4. Install `Loguru` in development mode::
Expand All @@ -61,7 +61,7 @@ Prefer using a relatively recent Python version as some dependencies required fo
7. Implement the modifications wished. During the process of development, honor `PEP 8`_ as much as possible.
8. Add unit tests (don't hesitate to be exhaustive!) and ensure none are failing using::

$ tox
$ tox -e tests

9. Remember to update documentation if required.
10. If your development modifies `Loguru` behavior, update the ``CHANGELOG.rst`` file with what you improved.
Expand Down
19 changes: 15 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
[tox]
skip_missing_interpreters = True
envlist = py{35,36,37,38,39,310,py3}
envlist = lint, tests, docs

[testenv]
setenv = PYTHONPATH = {toxinidir}
extras = dev

[testenv:lint]
description = Run linting checks on all project files.
commands =
pre-commit run --show-diff-on-failure --all-files

[testenv:tests]
description = Run the tests and generate code coverage.
commands =
coverage erase
pytest --cov loguru/ --cov-report=
coverage report -m
coverage xml

[testenv:docs]
description = Build the HTML documentation.
commands =
sphinx-build -a -b html -W --keep-going docs/ docs/build

[isort]
line_length = 100
profile = black
Expand All @@ -23,12 +36,10 @@ ignore =
exclude =
tests/exceptions/source


[pytest]
addopts = -l
testpaths =
tests


[mypy]
mypy_path = $MYPY_CONFIG_FILE_DIR/loguru

0 comments on commit 2239669

Please sign in to comment.