mirror of
https://github.com/Radarr/Radarr
synced 2026-01-23 16:04:18 +01:00
feat(ci): add GitHub Actions and Docker configuration
This commit is contained in:
parent
0fd723286f
commit
4fd16998d5
15 changed files with 210 additions and 0 deletions
138
.github/workflows/build.yml
vendored
Normal file
138
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
name: CI
|
||||
|
||||
permissions:
|
||||
packages: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [develop, master]
|
||||
paths-ignore:
|
||||
- ".github/**"
|
||||
- "src/Radarr.Api.*/openapi.json"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- ".github/**"
|
||||
- "src/NzbDrone.Core/Localization/Core"
|
||||
- "src/Radarr.Api.*/openapi.json"
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: "8.0.405"
|
||||
LOGARR_VERSION: 5.17.0
|
||||
OUTPUT_FOLDER: ./_output
|
||||
ARTIFACTS_FOLDER: ./_artifacts
|
||||
TESTS_FOLDER: ./_tests
|
||||
BUILD_SOURCEBRANCHNAME: ${{ github.head_ref || github.ref_name }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: jdx/mise-action@v3
|
||||
|
||||
- name: Setup Environment Variables
|
||||
id: variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "SDK_PATH=${{ env.DOTNET_ROOT }}/sdk/${DOTNET_VERSION}" >> "$GITHUB_ENV"
|
||||
echo "DATE=$(date --rfc-3339=date)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Cache NuGet packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: _cache/nuget
|
||||
key: nuget-${{ runner.os }}-${{ hashFiles('src/Directory.Packages.props', 'src/**/*.csproj', 'global.json') }}
|
||||
restore-keys: |
|
||||
nuget-${{ runner.os }}-
|
||||
|
||||
- name: Cache Node modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
_cache/node
|
||||
node_modules
|
||||
key: node-${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock') }}
|
||||
restore-keys: |
|
||||
node-${{ runner.os }}-
|
||||
|
||||
- name: Cache MSBuild outputs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: _cache/msbuild
|
||||
key: msbuild-${{ runner.os }}-${{ hashFiles('src/**/*.cs', 'src/**/*.csproj', 'src/**/*.targets', 'src/**/*.props') }}
|
||||
restore-keys: |
|
||||
msbuild-${{ runner.os }}-${{ hashFiles('src/**/*.cs', 'src/**/*.csproj', 'src/**/*.targets', 'src/**/*.props') }}
|
||||
msbuild-${{ runner.os }}-
|
||||
|
||||
- name: Cache Webpack
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: _cache/webpack
|
||||
key: webpack-${{ runner.os }}-${{ hashFiles('frontend/src/**/*', 'yarn.lock') }}
|
||||
restore-keys: |
|
||||
webpack-${{ runner.os }}-${{ hashFiles('frontend/src/**/*', 'yarn.lock') }}
|
||||
webpack-${{ runner.os }}-
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: ./build.sh --backend --frontend
|
||||
env:
|
||||
LOGARRVERSION: ${{ env.LOGARR_VERSION }}.${{ github.run_number }}
|
||||
|
||||
- name: Prepare tests
|
||||
run: |
|
||||
mkdir -p _tests/bin
|
||||
cp _output/net8.0/linux-x64/publish/Radarr _tests/bin/
|
||||
chmod +x _tests/bin/Radarr
|
||||
find _tests -name "Radarr.Test.Dummy" -exec chmod a+x {} \;
|
||||
|
||||
- name: Test
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
run: ./test.sh Linux Unit Test
|
||||
|
||||
- name: Report test results
|
||||
uses: dorny/test-reporter@v2
|
||||
if: always()
|
||||
with:
|
||||
name: Unit Test Results
|
||||
path: "**/TestResult.xml"
|
||||
list-tests: "failed"
|
||||
reporter: dotnet-nunit
|
||||
fail-on-error: false
|
||||
fail-on-empty: false
|
||||
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=raw,value=v${{ env.LOGARR_VERSION }}
|
||||
type=raw,value=v${{ env.LOGARR_VERSION }}.${{ github.run_number }}
|
||||
|
||||
- uses: docker/login-action@v3
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/Dockerfile
|
||||
platforms: "linux/amd64,linux/arm64"
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_BRANCH=${{ env.BUILD_SOURCEBRANCHNAME }}
|
||||
COMMIT_HASH=${{ github.event.pull_request.head.sha || github.sha }}
|
||||
BUILD_DATE=${{ env.DATE }}
|
||||
43
docker/Dockerfile
Normal file
43
docker/Dockerfile
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
FROM ghcr.io/linuxserver/baseimage-alpine:3.21
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
ENV XDG_CONFIG_HOME="/config/xdg" \
|
||||
COMPlus_EnableDiagnostics=0 \
|
||||
TMPDIR=/run/radarr-temp
|
||||
|
||||
RUN apk add -U --upgrade --no-cache \
|
||||
icu-libs \
|
||||
sqlite-libs \
|
||||
xmlstarlet
|
||||
|
||||
ARG GIT_BRANCH
|
||||
ARG COMMIT_HASH
|
||||
ARG BUILD_DATE
|
||||
|
||||
LABEL maintainer="cody-k" \
|
||||
org.opencontainers.image.title="Logarr" \
|
||||
org.opencontainers.image.description="All-in-one media manager (Radarr fork)" \
|
||||
org.opencontainers.image.source="https://github.com/Cody-k/logarr"
|
||||
|
||||
RUN mkdir -p /app/radarr
|
||||
|
||||
RUN --mount=type=bind,source=_output,target=_output \
|
||||
case "$TARGETPLATFORM" in \
|
||||
"linux/amd64") cp -r /_output/net8.0/linux-musl-x64 /app/radarr/bin ;; \
|
||||
"linux/arm64") cp -r /_output/net8.0/linux-musl-arm64 /app/radarr/bin ;; \
|
||||
"darwin/amd64") cp -r /_output/net8.0/osx-x64 /app/radarr/bin ;; \
|
||||
"darwin/arm64") cp -r /_output/net8.0/osx-arm64 /app/radarr/bin ;; \
|
||||
"windows/amd64") cp -r /_output/net8.0/win-x64 /app/radarr/bin ;; \
|
||||
*) echo "Unknown platform: $TARGETPLATFORM" && exit 1 ;; \
|
||||
esac; \
|
||||
cp -r /_output/UI /app/radarr/bin/UI
|
||||
|
||||
RUN echo -e "UpdateMethod=docker\nBranch=${GIT_BRANCH}\nPackageVersion=${COMMIT_HASH}}\nPackageAuthor=cody-k" > /app/radarr/package_info && \
|
||||
printf "version: ${COMMIT_HASH}}\nBuild-date: ${BUILD_DATE}" > /build_version
|
||||
|
||||
COPY docker/root/ /
|
||||
|
||||
EXPOSE 7878
|
||||
|
||||
VOLUME /config
|
||||
9
docker/root/etc/s6-overlay/s6-rc.d/init-radarr-config/run
Executable file
9
docker/root/etc/s6-overlay/s6-rc.d/init-radarr-config/run
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
|
||||
mkdir -p /run/radarr-temp
|
||||
|
||||
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
|
||||
lsiown -R abc:abc \
|
||||
/config \
|
||||
/run/radarr-temp
|
||||
fi
|
||||
|
|
@ -0,0 +1 @@
|
|||
oneshot
|
||||
1
docker/root/etc/s6-overlay/s6-rc.d/init-radarr-config/up
Normal file
1
docker/root/etc/s6-overlay/s6-rc.d/init-radarr-config/up
Normal file
|
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-radarr-config/run
|
||||
3
docker/root/etc/s6-overlay/s6-rc.d/svc-radarr/data/check
Executable file
3
docker/root/etc/s6-overlay/s6-rc.d/svc-radarr/data/check
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
|
||||
curl -fsSL http://localhost:7878/ping > /dev/null 2>&1
|
||||
|
|
@ -0,0 +1 @@
|
|||
3
|
||||
13
docker/root/etc/s6-overlay/s6-rc.d/svc-radarr/run
Executable file
13
docker/root/etc/s6-overlay/s6-rc.d/svc-radarr/run
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
|
||||
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
|
||||
exec \
|
||||
s6-notifyoncheck -d -n 300 -w 1000 \
|
||||
cd /app/radarr/bin s6-setuidgid abc /app/radarr/bin/Radarr \
|
||||
-nobrowser -data=/config
|
||||
else
|
||||
exec \
|
||||
s6-notifyoncheck -d -n 300 -w 1000 \
|
||||
cd /app/radarr/bin /app/radarr/bin/Radarr \
|
||||
-nobrowser -data=/config
|
||||
fi
|
||||
1
docker/root/etc/s6-overlay/s6-rc.d/svc-radarr/type
Normal file
1
docker/root/etc/s6-overlay/s6-rc.d/svc-radarr/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
longrun
|
||||
Loading…
Reference in a new issue