mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-05-07 12:10:20 +02:00
Build each architecture on its own native runner (ubuntu-24.04 for amd64, ubuntu-24.04-arm for arm64) in parallel, export as OCI tarballs, then merge into a multi-arch manifest at publish time. Eliminates ~25 minutes of QEMU emulation overhead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
282 lines
7.7 KiB
YAML
282 lines
7.7 KiB
YAML
name: Build, Test & Docker
|
|
|
|
on:
|
|
push:
|
|
branches: [main, feature/**]
|
|
paths-ignore:
|
|
- 'src/NzbDrone.Core/Localization/Core/**'
|
|
- 'src/Prowlarr.Api.*/openapi.json'
|
|
pull_request:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- 'src/NzbDrone.Core/Localization/Core/**'
|
|
- 'src/Prowlarr.Api.*/openapi.json'
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version tag (e.g. 2.3.3.1234)"
|
|
required: false
|
|
type: string
|
|
|
|
env:
|
|
DOTNET_VERSION: '8.0.x'
|
|
DOTNET_NOLOGO: true
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
|
NODE_VERSION: '20'
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
backend:
|
|
name: Build Backend (${{ matrix.os }})
|
|
runs-on: ${{ matrix.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: Linux
|
|
runner: ubuntu-24.04
|
|
platform: Posix
|
|
- os: Windows
|
|
runner: windows-2025
|
|
platform: Windows
|
|
- os: macOS
|
|
runner: macos-15
|
|
platform: Posix
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 1
|
|
|
|
- uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
|
|
- name: Build
|
|
run: >-
|
|
dotnet msbuild -restore src/Prowlarr.sln
|
|
-p:Configuration=Release
|
|
-p:Platform=${{ matrix.platform }}
|
|
-p:EnableAnalyzers=false
|
|
|
|
unit-tests:
|
|
name: Unit Tests (${{ matrix.os }})
|
|
runs-on: ${{ matrix.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: Linux
|
|
runner: ubuntu-24.04
|
|
platform: Posix
|
|
- os: Windows
|
|
runner: windows-2025
|
|
platform: Windows
|
|
- os: macOS
|
|
runner: macos-15
|
|
platform: Posix
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 1
|
|
|
|
- uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
|
|
- name: Build
|
|
run: >-
|
|
dotnet msbuild -restore src/Prowlarr.sln
|
|
-p:Configuration=Release
|
|
-p:Platform=${{ matrix.platform }}
|
|
-p:EnableAnalyzers=false
|
|
|
|
- name: Create App Data Directory
|
|
shell: bash
|
|
run: |
|
|
if [ "$RUNNER_OS" = "Windows" ]; then
|
|
mkdir -p "$ProgramData/Prowlarr"
|
|
elif [ "$RUNNER_OS" = "macOS" ]; then
|
|
mkdir -p ~/Library/Application\ Support/Prowlarr
|
|
else
|
|
mkdir -p ~/.config/Prowlarr
|
|
fi
|
|
|
|
- name: Unit Tests
|
|
run: >-
|
|
dotnet test src/Prowlarr.sln
|
|
--no-build
|
|
-c Release
|
|
-p:Platform=${{ matrix.platform }}
|
|
--filter "Category!=ManualTest&Category!=IntegrationTest&Category!=AutomationTest"
|
|
--logger "trx;LogFileName=test-results.trx"
|
|
--results-directory ./TestResults
|
|
|
|
- name: Publish Test Results
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: test-results-${{ matrix.os }}
|
|
path: ./TestResults/*.trx
|
|
|
|
frontend:
|
|
name: Build Frontend
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: yarn
|
|
|
|
- name: Install Dependencies
|
|
run: yarn install --frozen-lockfile --network-timeout 120000
|
|
|
|
- name: Lint
|
|
run: |
|
|
yarn lint
|
|
yarn stylelint-linux
|
|
|
|
- name: Build
|
|
run: yarn run build --env production
|
|
|
|
docker-build:
|
|
name: Build Docker (${{ matrix.arch }})
|
|
runs-on: ${{ matrix.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: amd64
|
|
runner: ubuntu-24.04
|
|
platform: linux/amd64
|
|
- arch: arm64
|
|
runner: ubuntu-24.04-arm
|
|
platform: linux/arm64
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Determine version
|
|
id: version
|
|
env:
|
|
INPUT_VERSION: ${{ inputs.version }}
|
|
run: |
|
|
if [ -n "$INPUT_VERSION" ]; then
|
|
echo "version=$INPUT_VERSION" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "version=$(git describe --tags 2>/dev/null || echo "dev-${GITHUB_SHA::8}")" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
- name: Build and export
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: ${{ matrix.platform }}
|
|
push: false
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
VERSION=${{ steps.version.outputs.version }}
|
|
VERSION_BRANCH=${{ github.ref_name }}
|
|
cache-from: type=gha,scope=${{ matrix.arch }}
|
|
cache-to: type=gha,scope=${{ matrix.arch }},mode=max
|
|
outputs: type=oci,dest=/tmp/image-${{ matrix.arch }}.tar
|
|
|
|
- name: Upload image artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: docker-image-${{ matrix.arch }}
|
|
path: /tmp/image-${{ matrix.arch }}.tar
|
|
retention-days: 1
|
|
|
|
docker-publish:
|
|
name: Publish Docker Image
|
|
runs-on: ubuntu-latest
|
|
needs: [backend, unit-tests, frontend, docker-build]
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Download amd64 image
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: docker-image-amd64
|
|
path: /tmp
|
|
|
|
- name: Download arm64 image
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: docker-image-arm64
|
|
path: /tmp
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Determine version
|
|
id: version
|
|
env:
|
|
INPUT_VERSION: ${{ inputs.version }}
|
|
run: |
|
|
if [ -n "$INPUT_VERSION" ]; then
|
|
echo "version=$INPUT_VERSION" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "version=$(git describe --tags 2>/dev/null || echo "dev-${GITHUB_SHA::8}")" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=sha,prefix=
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
type=raw,value=${{ steps.version.outputs.version }},enable=${{ inputs.version != '' }}
|
|
|
|
- name: Load and push multi-arch manifest
|
|
run: |
|
|
# Import OCI images into buildx store
|
|
docker buildx imagetools create \
|
|
--tag "$FIRST_TAG" \
|
|
oci-archive:///tmp/image-amd64.tar \
|
|
oci-archive:///tmp/image-arm64.tar
|
|
|
|
# Apply all remaining tags
|
|
for tag in $ALL_TAGS; do
|
|
if [ "$tag" != "$FIRST_TAG" ]; then
|
|
docker buildx imagetools create --tag "$tag" "$FIRST_TAG"
|
|
fi
|
|
done
|
|
env:
|
|
FIRST_TAG: ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
|
|
ALL_TAGS: ${{ join(fromJSON(steps.meta.outputs.json).tags, ' ') }}
|