Skip to content

Ci: improving ci #73

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 7 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file is for the labeler workflow
# Documentation https://github.com/marketplace/actions/labeler

Documentation:
- changed-files:
- any-glob-to-any-file: [docs/**, .github/**, "./*.{md,mdx}"]
- all-globs-to-all-files: "!.github/workflows/*"

"Type: Test":
- changed-files:
- any-glob-to-any-file: [tests/**, ./*test*]

"Type: CI":
- changed-files:
- any-glob-to-any-file: [.github/workflows/**]

"Scope: Core":
- changed-files:
- any-glob-to-any-file: [src/**]
all-globs-to-all-files:
["!src/thread/decorators/*", "!src/thread/utils/*"]

"Scope: Utils":
- changed-files:
- any-glob-to-any-file: ["src/thread/utils/*"]

"Scope: Decorator":
- changed-files:
- any-glob-to-any-file: ["src/thread/decorators/*"]
25 changes: 25 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
labels:
- name: "Type: CI"
color: 54b2ff
description: A problem or enhancement related to continuous integration.

- name: "Type: Breaking"
color: a90000
description: A problem or enhancement related to a breaking change.
Expand Down Expand Up @@ -86,3 +90,24 @@ labels:
- name: "Skip-Changelog"
color: AEB1C2
description: Skip changelog in release tag

- name: "help wanted"
color: 008672
description: Help wanted

- name: "CI: Template Sync"
color: AEB1C2
description: Sync with upstream template

- name: "Scope: Core"
color: F9D0C4
description: A change that affects the core of thread

- name: "Scope: Decorator"
color: F9D0C4
description: A change that affects decorators

- name: "Scope: Utils"
color: 9BD0E6
description: A change that affects utilities or configuration

15 changes: 15 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Labeler

on: [pull_request]

# This workflow will require write permissions on pull requests
# 1. Repository Settings -> Actions -> General -> Workflow permissions
# Check "Read and write permissions"

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
29 changes: 29 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Linting

on: [push, pull_request]

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

jobs:
linting:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Install requirements
run: |
set -xe
python -m pip install ruff

- name: Lint with ruff
run: |
set -xe
python -m ruff --per-file-ignores="__init__.py:F401" --per-file-ignores="__init__.py:E402" .
2 changes: 1 addition & 1 deletion .github/workflows/test-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down
7 changes: 6 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,22 @@ exclude = [
indent-style = "space"
line-ending = "lf"
quote-style = "single"
docstring-code-format = true


[lint]
select = ["E4", "E7", "E9", "F", "B"]

# Avoid enforcing line-length violations (`E501`)
ignore = ["E501"]

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"


[lint.flake8-quotes]
docstring-quotes = "double"


# Ignore `E402` (import violations) in all `__init__.py` files, and in select subdirectories.
[lint.per-file-ignores]
"__init__.py" = ["E402", "F401"]
Expand Down
12 changes: 6 additions & 6 deletions src/thread/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ def __init__(
self.suppress_errors = suppress_errors

super().__init__(
target=_target,
args=args,
kwargs=kwargs,
name=name,
daemon=daemon,
group=group,
group,
_target,
name,
args,
kwargs,
*overflow_args,
daemon=daemon,
**overflow_kwargs,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_parallelprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_raises_StillRunningError():
)
new.start()
with pytest.raises(exceptions.ThreadStillRunningError):
new.results
_ = new.results


def test_raises_RunTimeError():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_raises_stillRunningError():
new.start()

with pytest.raises(exceptions.ThreadStillRunningError):
new.result
_ = new.result


def test_raises_ignoreSpecificError():
Expand Down
8 changes: 4 additions & 4 deletions tests/test_verbosity.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ def test_geTrue():
# >>>>>>>>>> Raising <<<<<<<<<< #
def test_ltRaise():
with pytest.raises(ValueError):
return Verbosity(0) < Exception()
_ = Verbosity(0) < Exception()


def test_leRaise():
with pytest.raises(ValueError):
return Verbosity(0) <= Exception()
_ = Verbosity(0) <= Exception()


def test_gtRaise():
with pytest.raises(ValueError):
return Verbosity(1) > Exception()
_ = Verbosity(1) > Exception()


def test_geRaise():
with pytest.raises(ValueError):
return Verbosity(1) >= Exception()
_ = Verbosity(1) >= Exception()