Skip to content

Commit

Permalink
Merge pull request #325 from Czarified/actions
Browse files Browse the repository at this point in the history
Actions Update
  • Loading branch information
Czarified authored Jul 4, 2024
2 parents f87ca55 + 9e6b65d commit 51e8de7
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[flake8]
select = B,B9,C,D,DAR,E,F,N,RST,S,W
ignore = E203,E501,RST201,RST203,RST301,W503,B907,B905,D101,D102
max-line-length = 80
max-line-length = 120
max-complexity = 10
docstring-convention = google
per-file-ignores = tests/*:S101
Expand Down
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
interval: weekly
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
interval: weekly
- package-ecosystem: pip
directory: "/docs"
schedule:
interval: daily
interval: weekly
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
interval: weekly
versioning-strategy: lockfile-only
allow:
- dependency-type: "all"
4 changes: 2 additions & 2 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip==24.0
nox==2024.4.15
nox-poetry==1.0.3
poetry==1.8.2
virtualenv==20.22.0
poetry==1.8.3
virtualenv==20.26.1
7 changes: 6 additions & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ on:
push:
branches:
- main
- master

jobs:
labeler:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
issues: write # <--- permission granted explicitely
security-events: write
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v5.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-delete: true
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
release:
name: Release
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Check out the repository
Expand All @@ -19,7 +21,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"

- name: Upgrade pip
run: |
Expand Down Expand Up @@ -71,7 +73,7 @@ jobs:
repository_url: https://test.pypi.org/legacy/

- name: Publish the release notes
uses: release-drafter/release-drafter@v5.25.0
uses: release-drafter/release-drafter@v6.0.0
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ jobs:
include:
- { python: "3.11", os: "ubuntu-latest", session: "pre-commit" }
- { python: "3.11", os: "ubuntu-latest", session: "safety" }
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
- { python: "3.11", os: "windows-latest", session: "tests" }
- { python: "3.10", os: "windows-latest", session: "tests" }
- { python: "3.11", os: "macos-latest", session: "tests" }
- { python: "3.11", os: "ubuntu-latest", session: "typeguard" }
- { python: "3.11", os: "ubuntu-latest", session: "xdoctest" }
Expand All @@ -40,7 +42,7 @@ jobs:

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt pip "pipx==1.4.3"
pip --version
- name: Upgrade pip in virtual environments
Expand All @@ -53,11 +55,14 @@ jobs:
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
- name: Install Poetry
shell: bash
run: |
pipx --version
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
poetry --version
- name: Install Nox
shell: bash
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
Expand Down Expand Up @@ -95,7 +100,7 @@ jobs:
if: always() && matrix.session == 'tests'
uses: "actions/upload-artifact@v4"
with:
name: coverage-data
name: coverage-data-${{ matrix.python}}-${{ matrix.os }}
path: ".coverage.*"

- name: Upload documentation
Expand All @@ -119,7 +124,7 @@ jobs:

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt pip "pipx==1.4.3"
pip --version
- name: Install Poetry
Expand All @@ -136,7 +141,8 @@ jobs:
- name: Download coverage data
uses: actions/download-artifact@v4
with:
name: coverage-data
pattern: coverage-data-*
merge-multiple: true

- name: Combine coverage data and display human readable report
run: |
Expand All @@ -147,4 +153,6 @@ jobs:
nox --session=coverage -- xml
- name: Upload coverage report
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v4.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
12 changes: 12 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"pre-commit",
"safety",
"tests",
"mypy",
"typeguard",
"xdoctest",
"docs-build",
Expand Down Expand Up @@ -156,6 +157,17 @@ def tests(session: Session) -> None:
session.notify("coverage", posargs=[])


@session(python=python_versions)
def mypy(session: Session) -> None:
"""Type-check using mypy."""
args = session.posargs or ["src", "tests", "docs/conf.py"]
session.install(".")
session.install("mypy", "pytest")
session.run("mypy", *args)
if not session.posargs:
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")


@session(python=python_versions[0])
def coverage(session: Session) -> None:
"""Produce the coverage report."""
Expand Down
2 changes: 1 addition & 1 deletion src/thymed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __post_init__(self) -> None:
raise e

@property
def is_active(self) -> [bool, Any]:
def is_active(self) -> Any:
"""The charge code is active if it has been activated, but not closed."""
# If the last item in the times list has only 1 entry,
# we assume the code is still active.
Expand Down
3 changes: 2 additions & 1 deletion src/thymed/thymer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from textual.containers import Container
from textual.containers import ScrollableContainer
from textual.reactive import reactive
from textual.reactive import var

# from textual.reactive import var
from textual.widget import Widget
from textual.widgets import Button
from textual.widgets import DataTable
Expand Down
2 changes: 1 addition & 1 deletion src/thymed/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

SIDEBAR_INFO = """
There are multiple tools available in Thymed. To use one, select it or hit the keybinding. The main area will be updated with the 'applet' along with some more information. :smiley:
"""
""" # noqa: B950

LINKS = """
Here are some links, you can click these!
Expand Down
10 changes: 5 additions & 5 deletions tests/test_chargecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ def fake_times(
# # # T E S T S # # #


def test_create():
def test_create() -> None:
"""If a ChargeCode can be created."""
the_code = ChargeCode("test_code", "description", 0)
assert not the_code.is_active


def test_punch(blank_code):
def test_punch(blank_code) -> None:
"""Punches a charge code, sees active. Punches again, sees inactive."""
blank_code.punch()
assert blank_code.is_active
Expand All @@ -150,7 +150,7 @@ def test_punch(blank_code):
assert not blank_code.is_active


def test_data(blank_code):
def test_data(blank_code) -> None:
"""Write some data, and instantiate a code that recognizes the times."""
blank_code.punch()
time.sleep(0.1)
Expand All @@ -164,7 +164,7 @@ def test_data(blank_code):
remove_test_data("99999998")


def test_multiple():
def test_multiple() -> None:
"""Make multiple for post_init checks."""
one = ChargeCode("One", "Tester 1, Tester One.", 1)
one.write_class()
Expand All @@ -178,7 +178,7 @@ def test_multiple():
remove_test_charge("2")


def test_fake_time(fake_times, blank_code):
def test_fake_time(fake_times, blank_code) -> None:
"""Build some real data to work with."""
blank_code.punch()
time.sleep(0.1)
Expand Down

0 comments on commit 51e8de7

Please sign in to comment.