Skip to content

Remove dead code: sample detection, media info pipeline, subtitles, r… #350

Remove dead code: sample detection, media info pipeline, subtitles, r…

Remove dead code: sample detection, media info pipeline, subtitles, r… #350

Workflow file for this run

name: CI
on:
push:
branches:
- main
- develop
paths-ignore:
- '*.md'
- 'docs/**'
- 'LICENSE'
- '.gitignore'
pull_request:
branches:
- main
- develop
paths-ignore:
- '*.md'
- 'docs/**'
- 'LICENSE'
- '.gitignore'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
DOTNET_VERSION: '10.0.x'
NODE_VERSION: '22.x'
NUGET_CERT_REVOCATION_MODE: offline
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: true
DOTNET_MULTILEVEL_LOOKUP: 0
jobs:
frontend-build:
name: Frontend Build
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Upload frontend build
uses: actions/upload-artifact@v7
with:
name: frontend-build
path: _output/UI
retention-days: 1
backend-build:
name: Backend Build
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Compute NuGet cache key
id: nuget-key
shell: bash
run: echo "hash=$(find src -name '*.csproj' | sort | xargs cat | tr -d '\r' | shasum -a 256 | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: NuGet cache
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ steps.nuget-key.outputs.hash }}
restore-keys: nuget-
enableCrossOsArchive: true
- name: Build
run: dotnet build src/Gamarr.sln --configuration Debug
- name: Upload backend build
uses: actions/upload-artifact@v7
with:
name: backend-build
path: |
_output
_tests
include-hidden-files: true
retention-days: 1
frontend-test:
name: Frontend Test
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: sudo unshare --net -- runuser -u runner -- yarn lint
- name: Format check
run: sudo unshare --net -- runuser -u runner -- yarn format:check
- name: Stylelint
run: sudo unshare --net -- runuser -u runner -- yarn stylelint-linux
- name: Test
run: sudo unshare --net -- runuser -u runner -- yarn test
unit-test-linux:
name: Unit Tests (Linux ${{ matrix.shard }})
runs-on: ubuntu-24.04
needs: [backend-build]
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- shard: core
assemblies: _tests/net8.0/Gamarr.Core.Test.dll
- shard: other
assemblies: _tests/net8.0/Gamarr.Common.Test.dll _tests/net8.0/Gamarr.Host.Test.dll _tests/net8.0/Gamarr.Api.Test.dll _tests/net8.0/Gamarr.Libraries.Test.dll _tests/net8.0/Gamarr.Update.Test.dll _tests/net8.0/Gamarr.Mono.Test.dll _tests/net8.0/Gamarr.Windows.Test.dll
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Download backend build
uses: actions/download-artifact@v8
with:
name: backend-build
- name: Fix artifact permissions
run: |
find _tests/net8.0 _output -maxdepth 1 -type f -exec file {} + | grep -iE 'ELF|executable' | cut -d: -f1 | xargs -r chmod +x
- name: Run Unit Tests
shell: bash
run: |
cat > /tmp/run-tests.sh << 'SCRIPT'
#!/bin/bash
ip link set lo up
shift # drop '--'
exec runuser -u runner -- "$@"
SCRIPT
chmod +x /tmp/run-tests.sh
for assembly in ${{ matrix.assemblies }}; do
sudo unshare --net -- /tmp/run-tests.sh -- \
dotnet test "$assembly" \
--filter "Category!=IntegrationTest&Category!=ExternalIntegrationTest&Category!=AutomationTest" \
--logger "trx;LogFileName=test-results-$(basename $assembly .dll).trx" \
--results-directory ./test-results
done
- name: Verify tests ran
if: always()
shell: bash
run: |
if [ -z "$(ls ./test-results/*.trx 2>/dev/null)" ]; then
echo "::error::No test results found - tests did not run"
exit 1
fi
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: unit-test-results-linux-${{ matrix.shard }}
path: ./test-results
retention-days: 7
unit-test-other:
name: Unit Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Compute NuGet cache key
id: nuget-key
shell: bash
run: echo "hash=$(find src -name '*.csproj' | sort | xargs cat | tr -d '\r' | shasum -a 256 | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: NuGet cache
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ steps.nuget-key.outputs.hash }}
restore-keys: nuget-
enableCrossOsArchive: true
- name: Build
run: dotnet build src/Gamarr.sln --configuration Debug
- name: Run Unit Tests
shell: bash
run: |
dotnet test src/Gamarr.sln \
--no-build \
--configuration Debug \
--filter "Category!=IntegrationTest&Category!=ExternalIntegrationTest&Category!=AutomationTest" \
--logger "trx;LogFileName=test-results.trx" \
--results-directory ./test-results
- name: Verify tests ran
if: always()
shell: bash
run: |
if [ ! -f ./test-results/test-results.trx ]; then
echo "::error::No test results found - tests did not run"
exit 1
fi
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: unit-test-results-${{ matrix.os }}
path: ./test-results
retention-days: 7
integration-test:
name: Integration Tests
runs-on: ubuntu-24.04
needs: [backend-build]
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Download backend build
uses: actions/download-artifact@v8
with:
name: backend-build
- name: Fix artifact permissions
run: |
find _tests/net8.0 _output -maxdepth 1 -type f -exec file {} + | grep -iE 'ELF|executable' | cut -d: -f1 | xargs -r chmod +x
- name: Run Integration Tests
shell: bash
run: |
sudo unshare --net -- bash -c '
ip link set lo up
runuser -u runner -- \
dotnet test _tests/net8.0/Gamarr.Integration.Test.dll \
--filter "Category=IntegrationTest" \
--logger "trx;LogFileName=integration-test-results.trx" \
--results-directory ./test-results
'
- name: Run External Integration Tests
shell: bash
run: |
dotnet test _tests/net8.0/Gamarr.Integration.Test.dll \
--filter "Category=ExternalIntegrationTest" \
--logger "trx;LogFileName=external-integration-test-results.trx" \
--results-directory ./test-results
- name: Verify tests ran
if: always()
shell: bash
run: |
if [ ! -f ./test-results/integration-test-results.trx ]; then
echo "::error::No test results found - tests did not run"
exit 1
fi
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: integration-test-results
path: ./test-results
retention-days: 7
automation-test:
name: Automation Tests
runs-on: ubuntu-24.04
needs: [frontend-build, backend-build]
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Download backend build
uses: actions/download-artifact@v8
with:
name: backend-build
- name: Download frontend build
uses: actions/download-artifact@v8
with:
name: frontend-build
path: _output/UI
- name: Fix artifact permissions
run: |
find _tests/net8.0 _output -maxdepth 1 -type f -exec file {} + | grep -iE 'ELF|executable' | cut -d: -f1 | xargs -r chmod +x
chmod +x _tests/net8.0/.playwright/node/linux-x64/node
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: playwright-${{ hashFiles('src/NzbDrone.Automation.Test/Gamarr.Automation.Test.csproj') }}
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pwsh _tests/net8.0/playwright.ps1 install --with-deps
- name: Install Playwright deps only
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: pwsh _tests/net8.0/playwright.ps1 install-deps
- name: Run Automation Tests
run: |
sudo unshare --net -- bash -c '
ip link set lo up
runuser -u runner -- \
dotnet test _tests/net8.0/Gamarr.Automation.Test.dll \
--filter "Category=AutomationTest&Category!=ExternalAutomationTest" \
--logger "trx;LogFileName=automation-test-results.trx" \
--results-directory ./test-results
'
- name: Run External Automation Tests
run: |
dotnet test _tests/net8.0/Gamarr.Automation.Test.dll \
--filter "Category=ExternalAutomationTest" \
--logger "trx;LogFileName=external-automation-test-results.trx" \
--results-directory ./test-results
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: automation-test-results
path: ./test-results
retention-days: 7
- name: Upload error screenshots
uses: actions/upload-artifact@v7
if: failure()
with:
name: automation-test-screenshots
path: ./*_screenshot.png
retention-days: 7
build-complete:
name: Build Complete
runs-on: ubuntu-24.04
needs: [frontend-build, backend-build, frontend-test, unit-test-linux, unit-test-other, integration-test, automation-test]
if: always()
steps:
- name: Check build status
run: |
failed=false
for result in "${{ needs.frontend-build.result }}" "${{ needs.backend-build.result }}" "${{ needs.frontend-test.result }}" "${{ needs.unit-test-linux.result }}" "${{ needs.unit-test-other.result }}" "${{ needs.integration-test.result }}" "${{ needs.automation-test.result }}"; do
if [[ "$result" == "failure" ]]; then
failed=true
fi
done
if [[ "$failed" == "true" ]]; then
echo "One or more jobs failed"
exit 1
fi
echo "All jobs completed successfully"