Assorted fix attempts

This commit is contained in:
ta264 2019-08-12 06:59:26 +01:00
commit 2be45f1f13
4 changed files with 126 additions and 141 deletions

3
.gitattributes vendored
View file

@ -1,6 +1,9 @@
# Auto detect text files and perform LF normalization # Auto detect text files and perform LF normalization
*text eol=lf *text eol=lf
# Explicitly set bash scripts to have unix endings
*.sh text eol=lf
# Custom for Visual Studio # Custom for Visual Studio
*.cs diff=csharp *.cs diff=csharp
*.sln merge=union *.sln merge=union

View file

@ -27,7 +27,8 @@ pr:
- develop - develop
stages: stages:
- stage: Build - stage: Build_Backend
displayName: Build Backend
jobs: jobs:
- job: Backend - job: Backend
@ -37,7 +38,7 @@ stages:
osName: 'Linux' osName: 'Linux'
imageName: 'ubuntu-16.04' imageName: 'ubuntu-16.04'
Mac: Mac:
osName: 'MacOS' osName: 'Mac'
imageName: 'macos-10.13' imageName: 'macos-10.13'
Windows: Windows:
osName: 'Windows' osName: 'Windows'
@ -67,19 +68,21 @@ stages:
- publish: $(outputFolder) - publish: $(outputFolder)
artifact: '$(osName)Backend' artifact: '$(osName)Backend'
condition: and(succeeded(), eq(variables['osName'], 'Windows')) condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- publish: $(Build.SourcesDirectory) # - publish: $(Build.SourcesDirectory)
artifact: 'CoverageBuild' # artifact: 'CoverageBuild'
condition: and(succeeded(), eq(variables['osName'], 'Windows')) # condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- bash: |
pwd
ls -R ./
- publish: $(testsFolder) - publish: $(testsFolder)
artifact: 'Tests' artifact: 'Tests'
condition: and(succeeded(), eq(variables['osName'], 'Windows')) condition: and(succeeded(), eq(variables['osName'], 'Windows'))
# - task: PublishPipelineArtifact@0
# displayName: Publish Tests Artifact
# inputs:
# artifactName: 'Tests'
# targetPath: '$(testsFolder)'
- stage: Build_Frontend
displayName: Build Backend
dependsOn: []
jobs:
- job: Frontend - job: Frontend
strategy: strategy:
matrix: matrix:
@ -87,7 +90,7 @@ stages:
osName: 'Linux' osName: 'Linux'
imageName: 'ubuntu-16.04' imageName: 'ubuntu-16.04'
Mac: Mac:
osName: 'MacOS' osName: 'Mac'
imageName: 'macos-10.13' imageName: 'macos-10.13'
Windows: Windows:
osName: 'Windows' osName: 'Windows'
@ -107,39 +110,10 @@ stages:
artifact: '$(osName)Frontend' artifact: '$(osName)Frontend'
condition: and(succeeded(), eq(variables['osName'], 'Windows')) condition: and(succeeded(), eq(variables['osName'], 'Windows'))
# - job: macOS
# displayName: macOS
# pool:
# vmImage: 'macOS-10.13'
# steps:
# - task: NodeTool@0
# inputs:
# versionSpec: '10.x'
# - checkout: self
# submodules: true
# - task: Bash@3
# displayName: Build Lidarr
# inputs:
# targetType: 'filePath'
# filePath: ./build.sh
# - job: Linux
# displayName: Linux
# pool:
# vmImage: 'ubuntu-16.04'
# steps:
# - task: NodeTool@0
# inputs:
# versionSpec: '10.x'
# - checkout: self
# submodules: true
# - task: Bash@3
# displayName: Build Lidarr
# inputs:
# targetType: 'filePath'
# filePath: ./build.sh
- stage: Package - stage: Package
dependsOn:
- Build_Backend
- Build_Frontend
jobs: jobs:
- job: Windows_Packages - job: Windows_Packages
displayName: Windows Packages displayName: Windows Packages
@ -206,20 +180,36 @@ stages:
env: env:
SENTRY_AUTH_TOKEN: $(sentryAuthToken) SENTRY_AUTH_TOKEN: $(sentryAuthToken)
- stage: Test - stage: Unit_Test
dependsOn: Package displayName: Unit Tests
dependsOn: Build_Backend
condition: succeeded() condition: succeeded()
jobs: jobs:
- job: Linux_Unit_Tests - job: Unit
displayName: Linux Unit strategy:
matrix:
Linux:
osName: 'Linux'
imageName: 'ubuntu-16.04'
Mac:
osName: 'Mac'
imageName: 'macos-10.13'
Windows:
osName: 'Windows'
imageName: 'vs2017-win2016'
pool: pool:
vmImage: 'ubuntu-16.04' vmImage: $(imageName)
steps: steps:
- script: | - bash: |
wget https://github.com/acoustid/chromaprint/releases/download/v1.4.3/chromaprint-fpcalc-1.4.3-linux-x86_64.tar.gz wget https://github.com/acoustid/chromaprint/releases/download/v1.4.3/chromaprint-fpcalc-1.4.3-linux-x86_64.tar.gz
sudo tar xf chromaprint-fpcalc-1.4.3-linux-x86_64.tar.gz --strip-components=1 --directory /usr/bin sudo tar xf chromaprint-fpcalc-1.4.3-linux-x86_64.tar.gz --strip-components=1 --directory /usr/bin
displayName: Install fpcalc displayName: Install fpcalc
- checkout: self condition: and(succeeded(), eq(variables['osName'], 'Linux'))
- powershell: Set-Service SCardSvr -StartupType Manual
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- checkout: none
- task: DownloadPipelineArtifact@2 - task: DownloadPipelineArtifact@2
displayName: Download Test Artifact displayName: Download Test Artifact
inputs: inputs:
@ -227,16 +217,70 @@ stages:
artifactName: Tests artifactName: Tests
targetPath: $(testsFolder) targetPath: $(testsFolder)
- task: Bash@3 - task: Bash@3
displayName: Linux Unit Tests displayName: Run Tests
inputs: inputs:
targetType: 'filePath' targetType: 'filePath'
filePath: ./test.sh filePath: '$(testsFolder)/test.sh'
arguments: Linux Unit Test arguments: '$(osName) Unit Test'
- task: PublishTestResults@2 - task: PublishTestResults@2
displayName: Publish Test Results
inputs: inputs:
testResultsFormat: 'NUnit' testResultsFormat: 'NUnit'
testResultsFiles: '**/TestResult.xml' testResultsFiles: '**/TestResult.xml'
testRunTitle: 'Linux Unit Tests' testRunTitle: '$(osName) Unit Tests'
# - job: Windows_Unit_Tests
# displayName: Windows Unit
# pool:
# vmImage: 'vs2017-win2016'
# steps:
# - checkout: self
# - task: DownloadPipelineArtifact@2
# displayName: Download Test Artifact
# inputs:
# buildType: 'current'
# artifactName: Tests
# targetPath: $(testsFolder)
# - task: Bash@3
# displayName: Windows Unit Tests
# inputs:
# targetType: 'filePath'
# filePath: ./test.sh
# arguments: Windows Unit Test
# - task: PublishTestResults@2
# inputs:
# testResultsFormat: 'NUnit'
# testResultsFiles: '**/TestResult.xml'
# testRunTitle: 'Windows Unit Tests'
# - job: Mac_Unit_Tests
# displayName: macOS Unit
# pool:
# vmImage: 'macOS-10.13'
# steps:
# - checkout: self
# - task: DownloadPipelineArtifact@2
# displayName: Download Test Artifact
# inputs:
# buildType: 'current'
# artifactName: Tests
# targetPath: $(testsFolder)
# - task: Bash@3
# displayName: macOS Unit Tests
# inputs:
# targetType: 'filePath'
# filePath: ./test.sh
# arguments: Mac Unit Test
# - task: PublishTestResults@2
# inputs:
# testResultsFormat: 'NUnit'
# testResultsFiles: '**/TestResult.xml'
# testRunTitle: 'macOS Unit Tests'
- stage: Integration_Automation
displayName: Integration / Tests
dependsOn: Package
jobs:
- job: Linux_Integration_Tests - job: Linux_Integration_Tests
displayName: Linux Integration displayName: Linux Integration
@ -280,29 +324,6 @@ stages:
testResultsFiles: '**/TestResult.xml' testResultsFiles: '**/TestResult.xml'
testRunTitle: 'Linux Integration Tests' testRunTitle: 'Linux Integration Tests'
- job: Windows_Unit_Tests
displayName: Windows Unit
pool:
vmImage: 'vs2017-win2016'
steps:
- checkout: self
- task: DownloadPipelineArtifact@2
displayName: Download Test Artifact
inputs:
buildType: 'current'
artifactName: Tests
targetPath: $(testsFolder)
- task: Bash@3
displayName: Windows Unit Tests
inputs:
targetType: 'filePath'
filePath: ./test.sh
arguments: Windows Unit Test
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '**/TestResult.xml'
testRunTitle: 'Windows Unit Tests'
- job: Windows_Integration_Tests - job: Windows_Integration_Tests
displayName: Windows Integration displayName: Windows Integration
@ -380,32 +401,9 @@ stages:
testResultsFiles: '**/TestResult.xml' testResultsFiles: '**/TestResult.xml'
testRunTitle: 'Windows Automation Tests' testRunTitle: 'Windows Automation Tests'
- job: Mac_Unit_Tests
displayName: macOS Unit
pool:
vmImage: 'macOS-10.13'
steps:
- checkout: self
- task: DownloadPipelineArtifact@2
displayName: Download Test Artifact
inputs:
buildType: 'current'
artifactName: Tests
targetPath: $(testsFolder)
- task: Bash@3
displayName: macOS Unit Tests
inputs:
targetType: 'filePath'
filePath: ./test.sh
arguments: Mac Unit Test
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '**/TestResult.xml'
testRunTitle: 'macOS Unit Tests'
- stage: Coverage - stage: Coverage
dependsOn: Package dependsOn: Build_Backend
condition: succeeded() condition: succeeded()
jobs: jobs:
- job: Unit_Test_Coverage - job: Unit_Test_Coverage
@ -413,18 +411,25 @@ stages:
pool: pool:
vmImage: 'vs2017-win2016' vmImage: 'vs2017-win2016'
steps: steps:
- checkout: none - checkout: self
submodules: true
#- bash: ./build.sh --only-backend #- bash: ./build.sh --only-backend
# displayName: Build Lidarr Backend # displayName: Build Lidarr Backend
# - task: DownloadPipelineArtifact@2
# inputs:
# buildType: 'current'
# artifactName: CoverageBuild
# targetPath: $(Build.SourcesDirectory)
#- publish: $(testsFolder)
# artifact: 'CoverageTest'
- task: DownloadPipelineArtifact@2 - task: DownloadPipelineArtifact@2
inputs: inputs:
buildType: 'current' buildType: 'current'
artifactName: CoverageBuild artifactName: Tests
targetPath: $(Build.SourcesDirectory) targetPath: $(testsFolder)
- bash: | - bash: |
pwd
ls -R ./ ls -R ./
#- publish: $(testsFolder)
# artifact: 'CoverageTest'
- task: Bash@3 - task: Bash@3
displayName: Coverage Unit Tests displayName: Coverage Unit Tests
inputs: inputs:

View file

@ -145,26 +145,6 @@ RunGulp()
ProgressEnd 'Running gulp' ProgressEnd 'Running gulp'
} }
CreateMdbs()
{
local path=$1
if [ $runtime = "dotnet" ] ; then
local pdbFiles=( $(find $path -name "*.pdb") )
for filename in "${pdbFiles[@]}"
do
if [ -e ${filename%.pdb}.dll ] ; then
tools/pdb2mdb/pdb2mdb.exe ${filename%.pdb}.dll
fi
if [ -e ${filename%.pdb}.exe ] ; then
tools/pdb2mdb/pdb2mdb.exe ${filename%.pdb}.exe
fi
done
echo "Removing PDBs"
find $path -name "*.pdb" -exec rm "{}" \;
fi
}
PackageMono() PackageMono()
{ {
ProgressStart 'Creating Mono Package' ProgressStart 'Creating Mono Package'
@ -174,9 +154,6 @@ PackageMono()
echo "Copying Binaries" echo "Copying Binaries"
cp -r $outputFolder $outputFolderLinux cp -r $outputFolder $outputFolderLinux
echo "Creating MDBs"
CreateMdbs $outputFolderLinux
echo "Removing Service helpers" echo "Removing Service helpers"
rm -f $outputFolderLinux/ServiceUninstall.* rm -f $outputFolderLinux/ServiceUninstall.*
rm -f $outputFolderLinux/ServiceInstall.* rm -f $outputFolderLinux/ServiceInstall.*
@ -270,9 +247,6 @@ PackageTests()
cp $outputFolder/fpcalc $testPackageFolder cp $outputFolder/fpcalc $testPackageFolder
cp ./test.sh $testPackageFolder cp ./test.sh $testPackageFolder
echo "Creating MDBs for tests"
CreateMdbs $testPackageFolder
rm -f $testPackageFolder/*.log.config rm -f $testPackageFolder/*.log.config
CleanFolder $testPackageFolder true CleanFolder $testPackageFolder true
@ -283,8 +257,8 @@ PackageTests()
echo "Copying CurlSharp libraries" echo "Copying CurlSharp libraries"
cp $sourceFolder/ExternalModules/CurlSharp/libs/i386/* $testPackageFolder cp $sourceFolder/ExternalModules/CurlSharp/libs/i386/* $testPackageFolder
echo "Copying dylibs" echo "Adding sqlite dylibs"
cp -r $outputFolderMacOS/*.dylib $testPackageFolder cp $sourceFolder/Libraries/Sqlite/*.dylib $testPackageFolder
ProgressEnd 'Creating Test Package' ProgressEnd 'Creating Test Package'
} }

15
test.sh
View file

@ -7,12 +7,13 @@ TEST_DIR="."
TEST_PATTERN="*Test.dll" TEST_PATTERN="*Test.dll"
ASSEMBLIES="" ASSEMBLIES=""
TEST_LOG_FILE="TestLog.txt" TEST_LOG_FILE="TestLog.txt"
COVERAGE_FILE="$TEST_DIR/Coverage.xml"
if [ -d "$TEST_DIR/_tests" ]; then if [ -d "$TEST_DIR/_tests" ]; then
TEST_DIR="$TEST_DIR/_tests" TEST_DIR="$TEST_DIR/_tests"
fi fi
COVERAGE_FILE="$TEST_DIR/Coverage.xml"
rm -f "$TEST_LOG_FILE" rm -f "$TEST_LOG_FILE"
# Uncomment to log test output to a file instead of the console # Uncomment to log test output to a file instead of the console
@ -23,7 +24,9 @@ NUNIT_COMMAND="$NUNIT"
NUNIT_PARAMS="--workers=1" NUNIT_PARAMS="--workers=1"
if [ "$PLATFORM" = "Mac" ]; then if [ "$PLATFORM" = "Mac" ]; then
echo "Mac sqlite options:"
LD_LIBRARY_PATH=/usr/bin:$LD_LIBRARY_PATH LD_LIBRARY_PATH=/usr/bin:$LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH
sqlite3 -version sqlite3 -version
sqlite3 :memory: "pragma compile_options" sqlite3 :memory: "pragma compile_options"
fi fi
@ -56,13 +59,13 @@ for i in `find $TEST_DIR -name "$TEST_PATTERN"`;
done done
if [ "$COVERAGE" = "Coverage" ]; then if [ "$COVERAGE" = "Coverage" ]; then
if [ "$PLATFORM" = "Windows" ] ; then if [ "$PLATFORM" = "Windows" ] || [ "$PLATFORM" = "Linux" ]; then
dotnet tool install coverlet.console --tool-path=./_tests/coverlet/ dotnet tool install coverlet.console --tool-path="$TEST_DIR/coverlet/"
OPEN_COVER="./_tests/coverlet/coverlet" OPEN_COVER="$TEST_DIR/coverlet/coverlet"
$OPEN_COVER ./_tests/ --verbosity "detailed" --format "cobertura" --output "$COVERAGE_FILE" --exclude "[Lidarr.*.Test]*" --exclude "[Lidarr.Test.*]*" --exclude "[Marr.Data]*" --exclude "[MonoTorrent]*" --exclude "[CurlSharp]*" --target "$NUNIT" --targetargs "$NUNIT_PARAMS --where=\"$WHERE\" $ASSEMBLIES"; $OPEN_COVER "$TEST_DIR/" --verbosity "detailed" --format "cobertura" --output "$COVERAGE_FILE" --exclude "[Lidarr.*.Test]*" --exclude "[Lidarr.Test.*]*" --exclude "[Marr.Data]*" --exclude "[MonoTorrent]*" --exclude "[CurlSharp]*" --target "$NUNIT" --targetargs "$NUNIT_PARAMS --where=\"$WHERE\" $ASSEMBLIES";
EXIT_CODE=$? EXIT_CODE=$?
else else
echo "Coverage only supported on Windows" echo "Coverage only supported on Windows and Linux"
exit 3 exit 3
fi fi
elif [ "$COVERAGE" = "Test" ] ; then elif [ "$COVERAGE" = "Test" ] ; then