Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

βž• πŸ‘·πŸ»β€β™‚οΈ Check for unused files #88

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
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
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

# Controls when the action will run.
on:
# Remark: uncomment one section only
# Remark: Next 1 line requires manual action, Click on action tab, then publish
# workflow_dispatch
# Remark: Next 5 lines triggers the workflow on push events for the main branch
push:
branches:
- dev
paths-ignore:
- "README.md"

jobs:
ci:
runs-on: ubuntu-latest
if: github.repository_owner == 'nightscout'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Create, Activate and share a Python Virtual Env
run: |
python -m venv venv
source venv/bin/activate
# Persist venv related variables across the steps below
# See: https://stackoverflow.com/a/74669486/386517
echo "PATH=$PATH" >> "$GITHUB_ENV"
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> "$GITHUB_ENV"

- name: Install Python Dependencies
run: pip install -r requirements.txt

- name: Check for unused files
run: CHECK_UNUSED_FILES=true mkdocs build -s
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ MKDOCS_EXPORTER_PDF=true mkdocs build
```

The PDF file is generated in`site/trio-docs.pdf`.

### Find Unused Files

To find unused (orphaned) files in the project:

```shell
CHECK_UNUSED_FILES=true mkdocs build -s
```

> [!INFO]
> We use the [`mkdocs-unused-files`](https://github.com/wilhelmer/mkdocs-unused-files) plugin.

## Contribute

Expand Down
1 change: 0 additions & 1 deletion dev-requirements.in
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
mkdocs-translate
Empty file added docs/trio-docs.pdf
Empty file.
17 changes: 17 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ plugins:
icon: material-file-download-outline
enabled: !!python/name:mkdocs_exporter.formats.pdf.buttons.download.enabled
attributes: !!python/name:mkdocs_exporter.formats.pdf.buttons.download.attributes
- unused_files:
enabled: !ENV [CHECK_UNUSED_FILES, False]
strict: true
excluded_files:
- back.html.j2
- background.png
- CNAME
- .DS_Store
- extra.css
- favicon.ico
- front.html.j2
- .keep
- mathjax.js
- mkdocs-exporter.js
- pdf.scss
- primary_color.css
- trio-docs.pdf
- search

extra_css:
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ mkdocs-include-markdown-plugin>=6.0.4
mkdocs-exclude>=1.0.2
mkdocs-open-in-new-tab==1.0.6
mkdocs-macros-plugin>=1.0.4
mkdocs-unused-files>=0.2.0
117 changes: 103 additions & 14 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,137 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile
#
babel==2.16.0
# via mkdocs-material
beautifulsoup4==4.12.3
# via
# mkdocs-exporter
# mkdocs-unused-files
bracex==2.5.post1
# via wcmatch
certifi==2024.8.30
# via requests
charset-normalizer==3.4.0
# via requests
click==8.1.7
# via mkdocs
colorama==0.4.6
# via mkdocs-material
ghp-import==2.1.0
greenlet==3.0.3
# via mkdocs
greenlet==3.1.1
# via playwright
hjson==3.1.0
# via
# mkdocs-macros-plugin
# super-collections
idna==3.10
Jinja2==3.1.4
# via requests
jinja2==3.1.4
# via
# mkdocs
# mkdocs-macros-plugin
# mkdocs-material
libsass==0.23.0
# via mkdocs-exporter
lxml==5.3.0
Markdown==3.7
MarkupSafe==3.0.1
# via mkdocs-exporter
markdown==3.7
# via
# mkdocs
# mkdocs-material
# pymdown-extensions
markupsafe==3.0.2
# via
# jinja2
# mkdocs
mergedeep==1.3.4
# via
# mkdocs
# mkdocs-get-deps
mkdocs==1.6.1
# via
# -r requirements.in
# mkdocs-exclude
# mkdocs-exporter
# mkdocs-include-markdown-plugin
# mkdocs-macros-plugin
# mkdocs-material
# mkdocs-open-in-new-tab
# mkdocs-unused-files
mkdocs-exclude==1.0.2
# via -r requirements.in
mkdocs-exporter==6.1.1
# via -r requirements.in
mkdocs-get-deps==0.2.0
mkdocs-include-markdown-plugin==6.2.2
mkdocs-macros-plugin==1.3.5
mkdocs-material==9.5.40
# via mkdocs
mkdocs-include-markdown-plugin==7.0.0
# via -r requirements.in
mkdocs-macros-plugin==1.3.7
# via -r requirements.in
mkdocs-material==9.5.42
# via -r requirements.in
mkdocs-material-extensions==1.3.1
# via mkdocs-material
mkdocs-open-in-new-tab==1.0.6
# via -r requirements.in
mkdocs-unused-files==0.2.0
# via -r requirements.in
packaging==24.1
# via
# mkdocs
# mkdocs-macros-plugin
paginate==0.5.7
# via mkdocs-material
pathspec==0.12.1
# via
# mkdocs
# mkdocs-macros-plugin
platformdirs==4.3.6
playwright==1.47.0
# via mkdocs-get-deps
playwright==1.48.0
# via mkdocs-exporter
pyee==12.0.0
Pygments==2.18.0
# via playwright
pygments==2.18.0
# via mkdocs-material
pymdown-extensions==10.11.2
pypdf==5.0.1
# via mkdocs-material
pypdf==5.1.0
# via mkdocs-exporter
python-dateutil==2.9.0.post0
PyYAML==6.0.2
pyyaml_env_tag==0.1
# via
# ghp-import
# mkdocs-macros-plugin
pyyaml==6.0.2
# via
# mkdocs
# mkdocs-get-deps
# mkdocs-macros-plugin
# pymdown-extensions
# pyyaml-env-tag
pyyaml-env-tag==0.1
# via mkdocs
regex==2024.9.11
# via mkdocs-material
requests==2.32.3
# via mkdocs-material
six==1.16.0
# via python-dateutil
soupsieve==2.6
super_collections==0.5.3
# via beautifulsoup4
super-collections==0.5.3
# via mkdocs-macros-plugin
termcolor==2.5.0
typing_extensions==4.12.2
# via mkdocs-macros-plugin
typing-extensions==4.12.2
# via pyee
urllib3==2.2.3
# via requests
watchdog==5.0.3
# via mkdocs
wcmatch==10.0
# via mkdocs-include-markdown-plugin