-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This redoes a lot of the config flow and sensor details and adds proper sensors for the various aspects of the library that one might want to track. It also better handles errors and implements automated releases. I ended up switching to a `requirements.txt` for pip just because it's easier to manage than poetry There is the start of support for translations and testing as well.
- Loading branch information
1 parent
a06da30
commit c7df290
Showing
21 changed files
with
559 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,52 +8,28 @@ on: | |
paths: | ||
- '**.py' | ||
|
||
env: | ||
POETRY_VERSION: 1.5.1 | ||
|
||
jobs: | ||
mypy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Audiobookshelf | ||
uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Load cached Poetry installation | ||
id: cached-poetry | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.local | ||
key: poetry-${{ env.POETRY_VERSION }} | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: ${{ env.POETRY_VERSION }} | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
- name: cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: pydeps-${{ hashFiles('**/poetry.lock') }} | ||
- name: Install dependencies | ||
run: poetry install --no-interaction --no-root | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
- name: Run MyPy | ||
run: | | ||
source .venv/bin/activate \ | ||
mypy ./custom_components/audiobookshelf | ||
ruff: | ||
runs-on: ubuntu-latest | ||
name: "Ruff" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Checkout Audiobookshelf | ||
uses: actions/checkout@v4 | ||
- name: Run Ruff | ||
uses: chartboost/ruff-action@v1 | ||
with: | ||
version: 0.0.272 | ||
src: './custom_components/audiobookshelf' | ||
- name: "Checkout the repository" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Set up Python" | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.12" | ||
cache: "pip" | ||
|
||
- name: "Install requirements" | ||
run: python3 -m pip install -r requirements.txt | ||
|
||
- name: "Lint" | ||
run: python3 -m ruff check ./custom_components/audiobookshelf | ||
|
||
- name: Run MyPy | ||
run: python3 -m mypy custom_components/audiobookshelf | ||
|
||
- name: "Format" | ||
run: python3 -m ruff format ./custom_components/audiobookshelf --check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: "Release" | ||
|
||
on: | ||
release: | ||
types: | ||
- "published" | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
release: | ||
name: "Release" | ||
runs-on: "ubuntu-latest" | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: "Checkout the repository" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "ZIP the integration directory" | ||
shell: "bash" | ||
run: | | ||
cd "${{ github.workspace }}/custom_components/audiobookshelf" | ||
zip "Audiobookshelf_${{ github.ref_name }}.zip" -r ./ | ||
- name: "Upload the ZIP file to the release" | ||
uses: "softprops/[email protected]" | ||
with: | ||
files: ${{ github.workspace }}/custom_components/audiobookshelf/Audiobookshelf_${{ github.ref_name }}.zip |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**.py' | ||
pull_request: | ||
paths: | ||
- '**.py' | ||
|
||
jobs: | ||
ruff: | ||
name: "Ruff" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Checkout the repository" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Set up Python" | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.12" | ||
cache: "pip" | ||
|
||
- name: "Install requirements" | ||
run: python3 -m pip install -r requirements.txt | ||
|
||
- name: Run tests | ||
run: python3 -m pytest tests -W ignore::DeprecationWarning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.