Skip to content
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
36 changes: 30 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,64 @@ name: Build
on:
push:
branches: [main, develop]
paths:
- 'Jellyfin.Plugin.ContentFilter/**'
- 'Jellyfin.Plugin.ContentFilter.Tests/**'
- '.github/workflows/build.yml'
pull_request:
branches: [main]
branches: [main, develop]
paths:
- 'Jellyfin.Plugin.ContentFilter/**'
- 'Jellyfin.Plugin.ContentFilter.Tests/**'
- '.github/workflows/build.yml'
workflow_dispatch:

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
cache: true
cache-dependency-path: |
Jellyfin.Plugin.ContentFilter/Jellyfin.Plugin.ContentFilter.csproj
Jellyfin.Plugin.ContentFilter.Tests/Jellyfin.Plugin.ContentFilter.Tests.csproj

- name: Restore dependencies
run: dotnet restore
run: dotnet restore Jellyfin.Plugin.ContentFilter.Tests/Jellyfin.Plugin.ContentFilter.Tests.csproj

- name: Build
run: dotnet build --no-restore --configuration Release
run: dotnet build Jellyfin.Plugin.ContentFilter.Tests/Jellyfin.Plugin.ContentFilter.Tests.csproj --no-restore --configuration Release

- name: Run tests
run: dotnet test --no-build --configuration Release --logger "trx;LogFileName=test-results.trx"
run: dotnet test Jellyfin.Plugin.ContentFilter.Tests/Jellyfin.Plugin.ContentFilter.Tests.csproj --no-build --configuration Release --logger "trx;LogFileName=test-results.trx" --results-directory TestResults

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: '**/*.trx'
path: TestResults/**/*.trx
if-no-files-found: warn
retention-days: 7

- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: plugin-build
path: '**/bin/Release/net9.0/'
path: Jellyfin.Plugin.ContentFilter/bin/Release/net9.0/
if-no-files-found: error
retention-days: 7
18 changes: 14 additions & 4 deletions .github/workflows/init-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,32 @@ name: Initialize gh-pages
on:
workflow_dispatch:

concurrency:
group: init-gh-pages
cancel-in-progress: false

jobs:
init:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create gh-pages branch
- name: Create or refresh gh-pages branch
run: |
git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} repo
cd repo
git checkout --orphan gh-pages
git rm -rf .

if git ls-remote --heads origin gh-pages | grep -q gh-pages; then
git checkout gh-pages
else
git checkout --orphan gh-pages
git rm -rf .
fi

echo '[]' > repository.json
echo '<h1>PureFin Plugin Repository</h1><p>Add this URL to Jellyfin: <code>https://BarbellDwarf.github.io/PureFin-Plugin/repository.json</code></p>' > index.html
git add repository.json index.html
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Initialize gh-pages"
git diff --staged --quiet || git commit -m "Initialize gh-pages"
git push origin gh-pages
29 changes: 29 additions & 0 deletions .github/workflows/lint-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint Workflows

on:
push:
branches: [main, develop]
paths:
- '.github/workflows/**'
pull_request:
branches: [main, develop]
paths:
- '.github/workflows/**'
workflow_dispatch:

concurrency:
group: lint-workflows-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
actionlint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- name: Lint GitHub Actions workflows
uses: reviewdog/action-actionlint@v1
9 changes: 8 additions & 1 deletion .github/workflows/release-ai-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
paths:
- 'ai-services/**'
- '.github/workflows/release-ai-services.yml'
workflow_dispatch:

concurrency:
group: release-ai-services-main
cancel-in-progress: false

permissions:
contents: write

jobs:
release-ai-services:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout
Expand Down Expand Up @@ -52,6 +58,7 @@
SERVICES=""
if [[ "${SHARED_CHANGED}" == "true" ]]; then
for service_dir in ai-services/services/*; do
[[ -d "${service_dir}" ]] || continue
service_name="$(basename "${service_dir}")"
SERVICES="${SERVICES} ${service_name}"
done
Expand All @@ -61,7 +68,7 @@
done
fi

SERVICES="$(echo "${SERVICES}" | xargs || true)"
SERVICES="$(echo "${SERVICES}" | tr ' ' '\n' | sed '/^$/d' | sort -u | xargs || true)"
if [[ -z "${SERVICES}" ]]; then
echo "should_release=false" >> "$GITHUB_OUTPUT"
echo "services=" >> "$GITHUB_OUTPUT"
Expand All @@ -75,7 +82,7 @@
id: semver
if: steps.detect.outputs.should_release == 'true'
shell: bash
run: |

Check failure on line 85 in .github/workflows/release-ai-services.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2129:style:45:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck] Raw Output: e:.github/workflows/release-ai-services.yml:85:9: shellcheck reported issue in this script: SC2129:style:45:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck]

Check warning on line 85 in .github/workflows/release-ai-services.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:17:17: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: i:.github/workflows/release-ai-services.yml:85:9: shellcheck reported issue in this script: SC2086:info:17:17: Double quote to prevent globbing and word splitting [shellcheck]

Check warning on line 85 in .github/workflows/release-ai-services.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:16:20: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: i:.github/workflows/release-ai-services.yml:85:9: shellcheck reported issue in this script: SC2086:info:16:20: Double quote to prevent globbing and word splitting [shellcheck]
set -euo pipefail
git fetch --tags --force

Expand Down
25 changes: 23 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,35 @@
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
pages: write
id-token: write

steps:
- uses: actions/checkout@v4

- name: Ensure gh-pages branch exists
shell: bash
run: |
set -euo pipefail

if git ls-remote --heads origin gh-pages | grep -q gh-pages; then
echo "gh-pages branch already exists."
exit 0
fi

git clone "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" repo
cd repo
git checkout --orphan gh-pages
git rm -rf .
echo '[]' > repository.json
echo '<h1>PureFin Plugin Repository</h1><p>Add this URL to Jellyfin: <code>https://BarbellDwarf.github.io/PureFin-Plugin/repository.json</code></p>' > index.html
git add repository.json index.html
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Initialize gh-pages"
git push origin gh-pages

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
Expand All @@ -35,7 +56,7 @@

- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT

Check warning on line 59 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:1:40: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: i:.github/workflows/release.yml:59:9: shellcheck reported issue in this script: SC2086:info:1:40: Double quote to prevent globbing and word splitting [shellcheck]

- name: Build plugin package
run: |
Expand All @@ -50,7 +71,7 @@

- name: Read checksum for manifest
id: checksum
run: |

Check warning on line 74 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:2:22: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: i:.github/workflows/release.yml:74:9: shellcheck reported issue in this script: SC2086:info:2:22: Double quote to prevent globbing and word splitting [shellcheck]

Check warning on line 74 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2035:info:1:11: Use ./*glob* or -- *glob* so names with dashes won't become options [shellcheck] Raw Output: i:.github/workflows/release.yml:74:9: shellcheck reported issue in this script: SC2035:info:1:11: Use ./*glob* or -- *glob* so names with dashes won't become options [shellcheck]
MD5=$(cat *.zip.md5 | head -1)
echo "MD5=${MD5}" >> $GITHUB_OUTPUT

Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/test-ai-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,45 @@ on:
branches: [main, develop]
paths:
- 'ai-services/**'
- '.github/workflows/test-ai-services.yml'
pull_request:
branches: [main]
branches: [main, develop]
paths:
- 'ai-services/**'
- '.github/workflows/test-ai-services.yml'
workflow_dispatch:

concurrency:
group: test-ai-services-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
cache-dependency-path: ai-services/tests/requirements-test.txt

- name: Install test dependencies
run: pip install -r ai-services/tests/requirements-test.txt
run: |
python -m pip install --upgrade pip
pip install -r ai-services/tests/requirements-test.txt

- name: Run tests
run: pytest ai-services/tests/ -v --tb=short

- name: Validate Python syntax
run: |
python -m py_compile ai-services/services/nsfw-detector/app.py
python -m py_compile ai-services/services/content-classifier/app.py
python -m py_compile ai-services/services/scene-analyzer/app.py
python -m compileall ai-services/services -q
python -m compileall ai-services/scripts -q
echo "All Python files syntax OK"
Loading