mirror of
https://github.com/theotherp/nzbhydra2.git
synced 2026-02-06 11:17:18 +00:00
Build and run on windows on GH actions
This commit is contained in:
parent
07fa48e3d8
commit
5fac09c088
21
.github/workflows/buildNative.yml
vendored
21
.github/workflows/buildNative.yml
vendored
@ -15,7 +15,8 @@ jobs:
|
||||
HYDRA_NATIVE_BUILD: true
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Log free memory
|
||||
- if: startsWith(matrix.os,'ubuntu')
|
||||
name: Log free memory
|
||||
run: free -s 1 -h -c 3
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
@ -59,6 +60,7 @@ jobs:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "Install all with Maven"
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
run: mvn --batch-mode clean install -pl !org.nzbhydra:linux-amd64-release,!org.nzbhydra:linux-arm64-release,!org.nzbhydra:windows-release,!org.nzbhydra:generic-release -DskipTests -T 1C
|
||||
|
||||
- name: "Run unit tests"
|
||||
@ -80,28 +82,35 @@ jobs:
|
||||
mvn --batch-mode -Pnative clean native:compile -DskipTests
|
||||
|
||||
- name: "Upload linux artifact"
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true' && startsWith(matrix.os,'ubuntu')
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: coreLinux
|
||||
path: core/target/core
|
||||
|
||||
- name: "Upload windows artifact"
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true' && startsWith(matrix.os,'windows')
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: coreWindows
|
||||
path: core/target/core.exe
|
||||
|
||||
- name: "Copy artifact to include folder"
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true' && startsWith(matrix.os,'ubuntu')
|
||||
run: |
|
||||
mv core/target/core ./docker/nativeTest/
|
||||
chmod +x ./docker/nativeTest/core
|
||||
|
||||
- name: "Login to GitHub Container Registry"
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true' && startsWith(matrix.os,'ubuntu')
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "Build core and push container"
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
- name: "Build and push core container"
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true' && startsWith(matrix.os,'ubuntu')
|
||||
run: |
|
||||
cp other/wrapper/nzbhydra2wrapperPy3.py ./docker/nativeTest/
|
||||
cd ./docker/nativeTest/
|
||||
|
||||
139
.github/workflows/system-test.yml
vendored
139
.github/workflows/system-test.yml
vendored
@ -58,14 +58,14 @@ jobs:
|
||||
docker tag mockserver:3.1.0 ghcr.io/theotherp/mockserver:3.1.0
|
||||
docker push ghcr.io/theotherp/mockserver:3.1.0
|
||||
|
||||
runSystemTests:
|
||||
runSystemTestsLinux:
|
||||
needs: [ waitForNative, buildMockserver ]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
test: [ { port: 5076, name: core }, { port: 5077, name: v1Migration } ]
|
||||
env:
|
||||
spring_profiles_active: build,systemtest,${{ matrix.test.name }}
|
||||
spring_profiles_active: build,systemtest,testdocker,${{ matrix.test.name }}
|
||||
nzbhydra_port: ${{ matrix.test.port }}
|
||||
nzbhydra.port: ${{ matrix.test.port }}
|
||||
nzbhydra_name: ${{ matrix.test.name }}
|
||||
@ -83,8 +83,8 @@ jobs:
|
||||
distribution: 'adopt'
|
||||
cache: 'maven'
|
||||
|
||||
- name: "Install"
|
||||
run: mvn --batch-mode clean install -DskipTests -pl org.nzbhydra:nzbhydra2,org.nzbhydra:shared,org.nzbhydra:mapping,org.nzbhydra:assertions
|
||||
- name: "Install maven"
|
||||
run: mvn --batch-mode clean install -DskipTests -pl org.nzbhydra:nzbhydra2,org.nzbhydra:shared,org.nzbhydra:mapping,org.nzbhydra:assertions
|
||||
|
||||
- name: "Create docker network"
|
||||
run: docker network create systemtest
|
||||
@ -96,9 +96,9 @@ jobs:
|
||||
|
||||
- name: "Run docker compose"
|
||||
run: |
|
||||
cd docker
|
||||
cd docker/docker-compose-systemtest/linux
|
||||
docker-compose up -d
|
||||
cd ..
|
||||
cd ../../..
|
||||
|
||||
- name: "Wait for healthy containers"
|
||||
run: |
|
||||
@ -118,7 +118,7 @@ jobs:
|
||||
- name: "Write docker-compose logs"
|
||||
if: always()
|
||||
run: |
|
||||
cd docker
|
||||
cd docker/docker-compose-systemtest/linux
|
||||
echo "Writing docker compose logs to files"
|
||||
docker-compose logs --no-color radarr > docker-compose-radarr.log
|
||||
docker-compose logs --no-color sonarr > docker-compose-sonarr.log
|
||||
@ -127,19 +127,20 @@ jobs:
|
||||
docker-compose logs --no-color v1Migration > docker-compose-v1Migration.log
|
||||
echo "Found log files:"
|
||||
find . -name "*.log"
|
||||
cd ..
|
||||
cd ../../..
|
||||
|
||||
- name: "Truncate large log files"
|
||||
if: always()
|
||||
# If the logs are larger than 1MB there's probably something wrong
|
||||
run: |
|
||||
shopt -s globstar
|
||||
for d in ./**/*.log ; do (truncate --size=1M $d); done
|
||||
|
||||
- name: "Upload data folder artifact"
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: data
|
||||
name: dataLinux
|
||||
path: /tmp/hydra
|
||||
|
||||
- name: "Upload test logs artifact"
|
||||
@ -154,7 +155,7 @@ jobs:
|
||||
if: always()
|
||||
with:
|
||||
name: ${{ matrix.test.name }}-docker-logs
|
||||
path: docker/*.log
|
||||
path: docker/docker-compose-systemtest/linux/*.log
|
||||
|
||||
- name: "Create test Report"
|
||||
uses: dorny/test-reporter@v1
|
||||
@ -164,3 +165,121 @@ jobs:
|
||||
name: System test report ${{ matrix.test.name }}
|
||||
path: "**/surefire-reports/*.xml"
|
||||
reporter: java-junit
|
||||
|
||||
|
||||
|
||||
|
||||
runSystemTestsWindows:
|
||||
needs: [ waitForNative, buildMockserver ]
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
spring_profiles_active: build,systemtest,core,testwindows
|
||||
nzbhydra_port: 5076
|
||||
nzbhydra.port: 5076
|
||||
nzbhydra_name: windows
|
||||
NZBHYDRANAME: windows
|
||||
nzbhydra.name: windows
|
||||
steps:
|
||||
- name: "Check out source"
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: "Download windows artifact from current workflow"
|
||||
id: "downloadArtifactThisBuild"
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@master
|
||||
with:
|
||||
name: coreWindows
|
||||
path: ./
|
||||
|
||||
- name: "Check if core.exe was downloaded"
|
||||
id: checkCoreExe
|
||||
uses: andstor/file-existence-action@v1
|
||||
with:
|
||||
files: core.exe
|
||||
|
||||
- name: "Download windows artifact from previous workflow if no native build was executed"
|
||||
if: ${{steps.checkCoreExe.outputs.files_exists == 'false'}}
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
with:
|
||||
name: coreWindows
|
||||
#Search for matching artifact in any of the last completed workflows
|
||||
search_artifacts: true
|
||||
workflow_conclusion: 'completed'
|
||||
path: .
|
||||
|
||||
- name: "Set up JDK 17"
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'adopt'
|
||||
cache: 'maven'
|
||||
|
||||
- name: "Install maven"
|
||||
run: mvn --batch-mode clean install -DskipTests -pl org.nzbhydra:nzbhydra2,org.nzbhydra:shared,org.nzbhydra:mapping,org.nzbhydra:assertions,org.nzbhydra:mockserver
|
||||
|
||||
- name: "Copy mockserver"
|
||||
run: |
|
||||
copy other/mockserver/target/*-exec.jar exec.jar
|
||||
|
||||
- name: "List files in folder"
|
||||
run: ls
|
||||
|
||||
- name: "Add mockserver to /etc/hosts"
|
||||
run: |
|
||||
$file = "C:\Windows\System32\drivers\etc\hosts"
|
||||
$hostfile = Get-Content $file
|
||||
$hostfile += "127.0.0.1 mockserver"
|
||||
Set-Content -Path $file -Value $hostfile -Force
|
||||
|
||||
- name: "Start mock server and hydra, run tests"
|
||||
uses: BerniWittmann/background-server-action@v1
|
||||
with:
|
||||
start: ./core.exe directstart, java -jar ./exec.jar
|
||||
command: mvn --batch-mode test -pl org.nzbhydra.tests:system -DtrimStackTrace=false
|
||||
|
||||
- name: "Shutdown hydra"
|
||||
uses: fjogeleit/http-request-action@v1
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
with:
|
||||
method: "GET"
|
||||
url: "http://127.0.0.1:5076/internalapi/control/shutdown"
|
||||
|
||||
- name: "Shutdown mockserver"
|
||||
uses: fjogeleit/http-request-action@v1
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
with:
|
||||
method: "POST"
|
||||
url: "http://127.0.0.1:5080/actuator/shutdown"
|
||||
|
||||
- name: "Upload data folder artifact"
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: dataWindows
|
||||
path: data
|
||||
|
||||
- name: "Upload test logs artifact"
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: windows-test-logs
|
||||
path: tests/**/*.log
|
||||
|
||||
- name: "Upload docker logs artifact"
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: windows-docker-logs
|
||||
path: docker/*.log
|
||||
|
||||
- name: "Create test Report"
|
||||
uses: dorny/test-reporter@v1
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: System test report windows
|
||||
path: "**/surefire-reports/*.xml"
|
||||
reporter: java-junit
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
main.useCsrf=false
|
||||
nzbhydra.changelogUrl=http://mockserver:5080/changelog
|
||||
nzbhydra.repositoryBaseUrl=http://mockserver:5080/repos/theotherp/nzbhydra2
|
||||
nzbhydra.newsUrl=http://mockserver:5080/static/news.json
|
||||
|
||||
@ -20,7 +20,7 @@ services:
|
||||
- PGID=1000
|
||||
- TZ=Europe/London
|
||||
volumes:
|
||||
- ./sonarr/data:/config
|
||||
- ../../sonarr/data:/config
|
||||
ports:
|
||||
- "8989:8989"
|
||||
networks: [ "systemtest" ]
|
||||
@ -33,7 +33,7 @@ services:
|
||||
- PGID=1000
|
||||
- TZ=Europe/London
|
||||
volumes:
|
||||
- ./radarr/data:/config
|
||||
- ../../radarr/data:/config
|
||||
ports:
|
||||
- "7878:7878"
|
||||
networks: [ "systemtest" ]
|
||||
37
docker/docker-compose-systemtest/windows/docker-compose.yaml
Normal file
37
docker/docker-compose-systemtest/windows/docker-compose.yaml
Normal file
@ -0,0 +1,37 @@
|
||||
version: '3'
|
||||
services:
|
||||
mockserver:
|
||||
image: ghcr.io/theotherp/mockserver:3.1.0
|
||||
container_name: mockserver
|
||||
ports:
|
||||
- "5080:5080"
|
||||
environment:
|
||||
- spring_profiles_active=build,systemtest
|
||||
network_mode: "host"
|
||||
restart: unless-stopped
|
||||
sonarr:
|
||||
image: lscr.io/linuxserver/sonarr:latest
|
||||
container_name: sonarr
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Europe/London
|
||||
volumes:
|
||||
- ../../sonarr/data:/config
|
||||
ports:
|
||||
- "8989:8989"
|
||||
network_mode: "host"
|
||||
restart: unless-stopped
|
||||
radarr:
|
||||
image: lscr.io/linuxserver/radarr:latest
|
||||
container_name: radarr
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Europe/London
|
||||
volumes:
|
||||
- ../../radarr/data:/config
|
||||
ports:
|
||||
- "7878:7878"
|
||||
network_mode: "host"
|
||||
restart: unless-stopped
|
||||
@ -9,9 +9,8 @@
|
||||
<LaunchBrowser>True</LaunchBrowser>
|
||||
<ApiKey>apikey</ApiKey>
|
||||
<AuthenticationMethod>Basic</AuthenticationMethod>
|
||||
<Branch>nightly</Branch>
|
||||
<Branch>master</Branch>
|
||||
<SslCertPath></SslCertPath>
|
||||
<SslCertPassword></SslCertPassword>
|
||||
<InstanceName>Radarr</InstanceName>
|
||||
<AuthenticationRequired>DisabledForLocalAddresses</AuthenticationRequired>
|
||||
</Config>
|
||||
@ -116,7 +116,11 @@
|
||||
<version>3.0.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
server.port=5080
|
||||
#spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/
|
||||
warnLogCategory
|
||||
management.endpoints.web.exposure.include=*
|
||||
management.endpoint.shutdown.enabled=true
|
||||
endpoints.shutdown.enabled=true
|
||||
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import logging
|
||||
# (C) Copyright 2023 TheOtherP (theotherp@posteo.net)
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -16,6 +16,7 @@
|
||||
# Just for pyinstaller
|
||||
|
||||
import sys
|
||||
import time
|
||||
|
||||
import nzbhydra2wrapperPy3
|
||||
import systemTray
|
||||
@ -23,5 +24,12 @@ import systemTray
|
||||
if __name__ == '__main__':
|
||||
thread = systemTray.start()
|
||||
nzbhydra2wrapperPy3.quiet = True
|
||||
nzbhydra2wrapperPy3.main(sys.argv[1:])
|
||||
systemTray.stop()
|
||||
try:
|
||||
nzbhydra2wrapperPy3.main(sys.argv[1:])
|
||||
systemTray.stop()
|
||||
except SystemExit as e:
|
||||
logging.getLogger('root').info("Wrapper main thread quit")
|
||||
# For some reason thread / process is kept alive without sleeping
|
||||
time.sleep(1)
|
||||
systemTray.stop()
|
||||
sys.exit(e.code)
|
||||
|
||||
@ -32,7 +32,7 @@ def shutdown():
|
||||
if result.status_code != 200:
|
||||
nzbhydra2wrapperPy3.process.terminate()
|
||||
stop()
|
||||
elif nzbhydra2wrapperPy3.process is not None:
|
||||
elif hasattr(nzbhydra2wrapperPy3, "process") and nzbhydra2wrapperPy3.process is not None:
|
||||
nzbhydra2wrapperPy3.process.terminate()
|
||||
stop()
|
||||
else:
|
||||
|
||||
BIN
releases/windows-release/include/NZBHydra2.exe
(Stored with Git LFS)
BIN
releases/windows-release/include/NZBHydra2.exe
(Stored with Git LFS)
Binary file not shown.
@ -30,6 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -72,13 +73,15 @@ public class NzbHandlingTest {
|
||||
@Test
|
||||
public void shouldSaveToBlackhole() throws Exception {
|
||||
final BaseConfig config = configManager.getCurrentConfig();
|
||||
config.getDownloading().setSaveNzbsTo(blackholeFolderNnzbhydra);
|
||||
config.getDownloading().setSaveNzbsTo(Paths.get(blackholeFolderNnzbhydra).toAbsolutePath().toString());
|
||||
configManager.setConfig(config);
|
||||
|
||||
final String guid = searchResultProvider.findOneGuid();
|
||||
hydraClient.put("/internalapi/saveNzbToBlackhole", guid);
|
||||
final File[] files = new File(blackholeFolderTestAccess).listFiles();
|
||||
assertThat(files).isNotEmpty();
|
||||
assertThat(files)
|
||||
.as("Expected files to exist in " + blackholeFolderTestAccess)
|
||||
.isNotNull().isNotEmpty();
|
||||
assertThat(files[0].getName()).endsWith(".nzb");
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
nzbhydra.mockUrl=http://mockserver:5080
|
||||
sonarr.host=http://sonarr:8989
|
||||
radarr.host=http://radarr:7878
|
||||
|
||||
#Where hydra is supposed to store NZBs
|
||||
blackholeFolder.nzbhydra=/hydraBlackhole
|
||||
#The folder under which the test can access the black hole
|
||||
blackholeFolder.testaccess=/tmp/hydraBlackhole_${nzbhydra.name}
|
||||
|
||||
docker.host=unix:///var/run/docker.sock
|
||||
radarr.host=http://radarr:7878
|
||||
@ -0,0 +1,6 @@
|
||||
#Where hydra is supposed to store NZBs
|
||||
blackholeFolder.nzbhydra=/hydraBlackhole
|
||||
#The folder under which the test can access the black hole
|
||||
blackholeFolder.testaccess=/tmp/hydraBlackhole_${nzbhydra.name}
|
||||
|
||||
docker.host=unix:///var/run/docker.sock
|
||||
@ -0,0 +1,4 @@
|
||||
#Where hydra is supposed to store NZBs
|
||||
blackholeFolder.nzbhydra=/hydraBlackhole
|
||||
#The folder under which the test can access the black hole
|
||||
blackholeFolder.testaccess=/hydraBlackhole
|
||||
@ -22,9 +22,5 @@ nzbhydra.mockUrl=http://127.0.0.1:5080
|
||||
spring.main.banner-mode=off
|
||||
sonarr.host=http://127.0.0.1:8989
|
||||
radarr.host=http://127.0.0.1:7878
|
||||
#Where hydra is supposed to store NZBs
|
||||
blackholeFolder.nzbhydra=${java.io.tmpdir}/hydraBlackhole
|
||||
#The folder under which the test can access the black hole
|
||||
blackholeFolder.testaccess=${java.io.tmpdir}/hydraBlackhole
|
||||
|
||||
docker.host=tcp://127.0.0.1:2376
|
||||
|
||||
Loading…
Reference in New Issue
Block a user