diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile deleted file mode 100644 index d4dd9a30a..000000000 --- a/.circleci/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM mono:5.18 - -RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y git ssh tar gzip ca-certificates wget zip wine wine32 wine64 libwine libwine:i386 -RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -E - -RUN apt-get install -y nodejs -RUN wget https://mediaarea.net/repo/deb/repo-mediaarea_1.0-7_all.deb && dpkg -i repo-mediaarea_1.0-7_all.deb && apt-get update -RUN apt-get install -y libmediainfo-dev libmediainfo0v5 mediainfo -RUN npm i -g npm -RUN apt-get install -y python3-pip && pip3 install gitchangelog pystache -RUN curl -O https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz && tar xvf go*.tar.gz && chown -R root:root ./go && mv go /usr/local -ENV GOPATH=$HOME/work -ENV PATH="${PATH}:/usr/local/go/bin:$GOPATH/bin" -RUN go get github.com/aktau/github-release -RUN npm install -g yarn \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 326758d5d..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,169 +0,0 @@ -version: 2 - -defaults: &defaults - docker: - - image: gallileo/radarr-cci-primary:5.8.9 - environment: - BUILD_VERSION: 2.0.0 - -jobs: - build: - <<: *defaults - steps: - - restore_cache: - keys: - - source-v1-{{ .Branch }}-{{ .Revision }} - - source-v1-{{ .Branch }}- - - source-v1- - - checkout - - run: git submodule update --init --recursive - - save_cache: - key: source-v1-{{ .Branch }}-{{ .Revision }} - paths: - - ".git" - - run: - name: Patching Assembly Info - command: sed -i "s/AssemblyVersion(\".*\")/AssemblyVersion(\"$BUILD_VERSION.$CIRCLE_BUILD_NUM\")/gi" src/NzbDrone.Common/Properties/SharedAssemblyInfo.cs && cat src/NzbDrone.Common/Properties/SharedAssemblyInfo.cs - - run: - name: Clean Build - command: ./build.sh Clean - - run: - name: Restore Nuget - command: ./build.sh NugetMono - - run: - name: Build - command: ./build.sh Build - - restore_cache: - keys: - - v1-npm-deps-{{ checksum "package.json" }} - # Find the most recent cache used from any branch - - v1-npm-deps- - - run: - name: Gulp - command: ./build.sh Gulp - - save_cache: - key: v1-npm-deps-{{ checksum "package.json" }} - paths: - - "node_modules" - - run: - name: Package - command: ./build.sh Package - - run: - name: Preparing Tests - command: mkdir -p _tests/reports/junit && mkdir -p ../.config/Radarr && chmod -R 777 ../.config - - persist_to_workspace: - root: . - # Must be relative path from root - paths: - - _output - - _output_mono - - _output_osx - - _output_osx_app - - _tests - - setup - - .circleci - - deploy.sh - unit_tests: - <<: *defaults - steps: - - attach_workspace: - at: . - - run: - name: Preparing Tests - command: mkdir -p ../.config/Radarr && chmod -R 777 ../.config - - run: - name: Unit Tests - command: ./_tests/test.sh Linux Unit - - store_test_results: - path: _tests/reports/ - - integration_tests: - <<: *defaults - steps: - - attach_workspace: - at: . - - run: - name: Copy Binaries for Integration Tests - command: cp -R _output_mono/ _tests/bin - - run: - name: Preparing Tests - command: mkdir -p ../.config/Radarr && chmod -R 777 ../.config - - run: - name: Integration Tests - command: ./_tests/test.sh Linux Integration - - store_test_results: - path: _tests/reports/ - publish_artifacts: - <<: *defaults - steps: - - attach_workspace: - at: . - - run: - name: "Creating packages" - command: | - mkdir -p _packages/ - cp -r _output/ _packages/Radarr - zip -r _packages/Radarr.${CIRCLE_BRANCH//\//-}.$BUILD_VERSION.$CIRCLE_BUILD_NUM.windows.zip _packages/Radarr - rm -rf _packages/Radarr - cp -r _output_mono/ _packages/Radarr - tar -zcvf _packages/Radarr.${CIRCLE_BRANCH//\//-}.$BUILD_VERSION.$CIRCLE_BUILD_NUM.linux.tar.gz -C _packages Radarr - rm -rf _packages/Radarr - cp -r _output_osx/ _packages/Radarr - tar -zcvf _packages/Radarr.${CIRCLE_BRANCH//\//-}.$BUILD_VERSION.$CIRCLE_BUILD_NUM.osx.tar.gz -C _packages Radarr - rm -rf _packages/Radarr - cd _output_osx_app/ - zip -r ../_packages/Radarr.${CIRCLE_BRANCH//\//-}.$BUILD_VERSION.$CIRCLE_BUILD_NUM.osx-app.zip * - - run: - name: "Creating Installer" - command: wine setup/inno/ISCC.exe setup/radarr.iss && cp -r setup/Output/Radarr* _packages/ - - store_artifacts: - path: _packages - destination: artifacts - #- run: - # name: "Deploying" - # command: chmod +x deploy.sh && ./deploy.sh - - persist_to_workspace: - root: . - # Must be relative path from root - paths: - - _packages - deploy: - <<: *defaults - steps: - - attach_workspace: - at: . - - restore_cache: - keys: - - source-v1-{{ .Branch }}-{{ .Revision }} - - source-v1-{{ .Branch }}- - - source-v1- - - checkout - - run: - name: Creating Release - command: export LC_ALL=C.UTF-8 && export changelog=$(GITCHANGELOG_CONFIG_FILENAME=.gitchangelog.rc.release gitchangelog) && echo "Deploying v$BUILD_VERSION.$CIRCLE_BUILD_NUM to Github, with changelog:\n\n$changelog" && github-release release -u Radarr -r Radarr -t "v$BUILD_VERSION" -p --draft -d "$changelog" -n "Pre-Release v$BUILD_VERSION" - - run: - name: Uploading Assets - command: cd _packages && ls Radarr.*.* | xargs -n1 -P0 -I{} -- github-release upload -u Radarr -r Radarr -t "v$BUILD_VERSION.$CIRCLE_BUILD_NUM" --name {} --file {} - -workflows: - version: 2 - - build_and_test: - jobs: - - build - - unit_tests: - requires: - - build - #- integration_tests: - # requires: - # - build - - publish_artifacts: - requires: - - build - #- request_deploy: - # type: approval - # requires: - # - publish_artifacts - #- deploy: - # requires: - # - request_deploy diff --git a/.circleci/nunit3-junit.xslt b/.circleci/nunit3-junit.xslt deleted file mode 100644 index 08e046ab8..000000000 --- a/.circleci/nunit3-junit.xslt +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.npmrc b/.npmrc deleted file mode 100644 index ad5884817..000000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -save-prefix="" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 65a4fcef8..000000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: csharp -solution: src/NzbDrone.sln -addons: - apt: - packages: - - nodejs -# - npm apparently not needed anymore. -script: - - ./build.sh - - chmod +x test.sh -# - ./test.sh Linux Unit Takes far too long, maybe even crashes travis :/ -after_success: - - chmod +x package.sh - - ./package.sh -notifications: - - webhooks: https://discordapp.com/api/webhooks/266910310219251712/V-QvCcnYkg3O8PMevcAJOJyCgrYkZQoF2pupLDGbaISNUECmYPd6LRwl3avKHsPyfgWP diff --git a/appveyor.yml b/appveyor.yml index 9224d3bd1..a12a1e32f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,60 +1,3 @@ -version: '2.0.0.{build}' - -image: Visual Studio 2017 - -assembly_info: - patch: true - file: 'src\NzbDrone.Common\Properties\SharedAssemblyInfo.cs' - assembly_version: '{version}' - assembly_file_version: '{version}' - assembly_informational_version: '{version}-rc1' - -environment: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - -install: - - git submodule update --init --recursive - -#init: -# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - -build_script: - - ps: ./build-appveyor.ps1 - -test: off -#test: -# assemblies: -# - '_tests\*Test.dll' -# categories: -# except: -# - IntegrationTest -# - AutomationTest - -artifacts: - - path: '_artifacts\*.zip' - - path: '_artifacts\*.exe' - - path: '_artifacts\*.tar.gz' - -cache: - - '%USERPROFILE%\.nuget\packages' - - node_modules -> package.json - -pull_requests: - do_not_increment_build_number: true - -on_failure: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - - ps: Get-ChildItem .\_artifacts\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - - ps: Get-ChildItem .\_artifacts\*.exe | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - - ps: Get-ChildItem .\_artifacts\*.tar.gz | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - -only_commits: +skip_commits: files: - - src/ - - osx/ - - gulp/ - - logo/ - - setup/ - - frontend/ - - appveyor.yml - - build-appveyor.cake + - '**/**' \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..6152d5533 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,485 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +variables: + outputFolder: './_output' + artifactsFolder: './_artifacts' + testsFolder: './_tests' + majorVersion: '2.0.0' + minorVersion: $[counter('minorVersion', 2000)] + radarrVersion: '$(majorVersion).$(minorVersion)' + buildName: '$(Build.SourceBranchName).$(radarrVersion)' + windowsInstaller: 'Radarr.$(buildName).windows-installer.exe' + windowsZip: 'Radarr.$(buildName).windows.zip' + macOsApp: 'Radarr.$(buildName).osx-app.zip' + macOsTar: 'Radarr.$(buildName).osx.tar.gz' + linuxTar: 'Radarr.$(buildName).linux.tar.gz' + sentryOrg: 'radarr' + +trigger: + branches: + include: + - develop + - aphrodite + +pr: +- develop +- aphrodite + +stages: + - stage: Build_Backend + displayName: Build Backend + + jobs: + - job: Backend + strategy: + matrix: + Linux: + osName: 'Linux' + imageName: 'ubuntu-16.04' + Mac: + osName: 'Mac' + imageName: 'macos-10.13' + Windows: + osName: 'Windows' + imageName: 'vs2017-win2016' + + pool: + vmImage: $(imageName) + steps: + # Set the build name properly. The 'name' property won't recursively expand so hack here: + - powershell: Write-Host "##vso[build.updatebuildnumber]$($env:RADARRVERSION)" + displayName: Set Build Name + - checkout: self + submodules: true + fetchDepth: 1 + - bash: ./build.sh --only-backend + displayName: Build Radarr Backend + - publish: $(outputFolder) + artifact: '$(osName)Backend' + displayName: Publish Backend + condition: and(succeeded(), eq(variables['osName'], 'Windows')) + - publish: $(testsFolder) + artifact: '$(osName)Tests' + displayName: Publish Test Package + condition: and(succeeded(), eq(variables['osName'], 'Windows')) + + - stage: Build_Frontend + displayName: Build Frontend + dependsOn: [] + + jobs: + - job: Frontend + strategy: + matrix: + Linux: + osName: 'Linux' + imageName: 'ubuntu-16.04' + Mac: + osName: 'Mac' + imageName: 'macos-10.13' + Windows: + osName: 'Windows' + imageName: 'vs2017-win2016' + pool: + vmImage: $(imageName) + steps: + - task: NodeTool@0 + displayName: Set Node.js version + inputs: + versionSpec: '10.x' + - checkout: self + submodules: true + fetchDepth: 1 + - bash: ./build.sh --only-frontend + displayName: Build Radarr Frontend + env: + FORCE_COLOR: 0 + - publish: $(outputFolder) + artifact: '$(osName)Frontend' + displayName: Publish Frontend + condition: and(succeeded(), eq(variables['osName'], 'Windows')) + + - stage: Package + dependsOn: + - Build_Backend + - Build_Frontend + jobs: + - job: Windows_Installer + displayName: Create Installer + pool: + vmImage: 'vs2017-win2016' + steps: + - checkout: self + fetchDepth: 1 + - task: DownloadPipelineArtifact@2 + inputs: + buildType: 'current' + artifactName: WindowsBackend + targetPath: _output + displayName: Fetch Backend + - task: DownloadPipelineArtifact@2 + inputs: + buildType: 'current' + artifactName: WindowsFrontend + targetPath: _output + displayName: Fetch Frontend + - bash: ./build.sh --only-packages + displayName: Create Packages + - bash: | + ./setup/inno/ISCC.exe "./setup/radarr.iss" + cp ./setup/output/Radarr.*windows.exe ${BUILD_ARTIFACTSTAGINGDIRECTORY}/${WINDOWSINSTALLER} + displayName: Create Windows installer + - publish: $(Build.ArtifactStagingDirectory) + artifact: 'WindowsInstaller' + displayName: Publish Installer + + - job: Other_Packages + displayName: Create Standard Packages + pool: + vmImage: 'ubuntu-16.04' + steps: + - bash: sudo apt install dos2unix + - checkout: self + fetchDepth: 1 + - task: DownloadPipelineArtifact@2 + inputs: + buildType: 'current' + artifactName: WindowsBackend + targetPath: _output + displayName: Fetch Backend + - task: DownloadPipelineArtifact@2 + inputs: + buildType: 'current' + artifactName: WindowsFrontend + targetPath: _output + displayName: Fetch Frontend + - bash: ./build.sh --only-packages + displayName: Create Packages + - bash: | + chmod a+x $(artifactsFolder)/macos/Radarr/Radarr + chmod a+x $(artifactsFolder)/macos-app/Radarr.app/Contents/MacOS/Radarr + displayName: Set Mac executable bits + - task: ArchiveFiles@2 + displayName: Create Windows zip + inputs: + archiveFile: '$(Build.ArtifactStagingDirectory)/$(windowsZip)' + archiveType: 'zip' + includeRootFolder: false + rootFolderOrFile: $(artifactsFolder)/windows + - task: ArchiveFiles@2 + displayName: Create MacOS app + inputs: + archiveFile: '$(Build.ArtifactStagingDirectory)/$(macOsApp)' + archiveType: 'zip' + includeRootFolder: false + rootFolderOrFile: $(artifactsFolder)/macos-app + - task: ArchiveFiles@2 + displayName: Create MacOS tar + inputs: + archiveFile: '$(Build.ArtifactStagingDirectory)/$(macOsTar)' + archiveType: 'tar' + tarCompression: 'gz' + includeRootFolder: false + rootFolderOrFile: $(artifactsFolder)/macos + - task: ArchiveFiles@2 + displayName: Create Linux tar + inputs: + archiveFile: '$(Build.ArtifactStagingDirectory)/$(linuxTar)' + archiveType: 'tar' + tarCompression: 'gz' + includeRootFolder: false + rootFolderOrFile: $(artifactsFolder)/linux + - publish: $(Build.ArtifactStagingDirectory) + artifact: 'Packages' + displayName: Publish Packages + - bash: | + echo "Uploading source maps to sentry" + curl -sL https://sentry.io/get-cli/ | bash + RELEASENAME="${RADARRVERSION}-${BUILD_SOURCEBRANCHNAME}" + sentry-cli releases new --finalize -p radarr -p radarr-ui -p radarr-update "${RELEASENAME}" + sentry-cli releases -p radarr-ui files "${RELEASENAME}" upload-sourcemaps _output/UI/ --rewrite + sentry-cli releases set-commits --auto "${RELEASENAME}" + sentry-cli releases deploys "${RELEASENAME}" new -e nightly + displayName: Publish Sentry Source Maps + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop')) + env: + SENTRY_AUTH_TOKEN: $(sentryAuthToken) + SENTRY_ORG: $(sentryOrg) + + - stage: Unit_Test + displayName: Unit Tests + dependsOn: Build_Backend + condition: succeeded() + jobs: + - job: Unit + strategy: + matrix: + Linux: + osName: 'Linux' + imageName: 'ubuntu-16.04' + Mac: + osName: 'Mac' + imageName: 'macos-10.13' + Windows: + osName: 'Windows' + imageName: 'vs2017-win2016' + + pool: + vmImage: $(imageName) + + steps: + - checkout: none + - task: DownloadPipelineArtifact@2 + displayName: Download Test Artifact + inputs: + buildType: 'current' + artifactName: WindowsTests + targetPath: $(testsFolder) + - powershell: Set-Service SCardSvr -StartupType Manual + displayName: Enable Windows Test Service + condition: and(succeeded(), eq(variables['osName'], 'Windows')) + - bash: | + sudo apt install dos2unix + dos2unix ${TESTSFOLDER}/test.sh + condition: and(succeeded(), eq(variables['osName'], 'Linux')) + - bash: | + brew install dos2unix + dos2unix ${TESTSFOLDER}/test.sh + condition: and(succeeded(), eq(variables['osName'], 'Mac')) + - task: Bash@3 + displayName: Run Tests + env: + DYLD_FALLBACK_LIBRARY_PATH: $(Build.SourcesDirectory)/_tests + TEST_DIR: $(Build.SourcesDirectory)/_tests + inputs: + targetType: 'filePath' + filePath: '$(testsFolder)/test.sh' + arguments: '$(osName) Unit Test' + - publish: TestResult.xml + artifact: 'TestResult' + displayName: Publish Test Result + condition: and(succeeded(), eq(variables['osName'], 'Windows')) + - task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '**/TestResult.xml' + testRunTitle: '$(osName) Unit Tests' + failTaskOnFailedTests: true + + - stage: Integration_Automation + displayName: Integration / Automation + dependsOn: Package + jobs: + + - job: Integration + strategy: + matrix: + Linux: + osName: 'Linux' + imageName: 'ubuntu-16.04' + pattern: 'Radarr.**.linux.tar.gz' + Mac: + osName: 'Mac' + imageName: 'macos-10.13' + pattern: 'Radarr.**.osx.tar.gz' + Windows: + osName: 'Windows' + imageName: 'vs2017-win2016' + pattern: 'Radarr.**.windows.zip' + + pool: + vmImage: $(imageName) + + steps: + - bash: | + SYMLINK=5_18_1 + MONOPREFIX=/Library/Frameworks/Mono.framework/Versions/$SYMLINK + echo "##vso[task.setvariable variable=DYLD_FALLBACK_LIBRARY_PATH;].:$MONOPREFIX/lib:/lib:/usr/lib:$DYLD_LIBRARY_FALLBACK_PATH" + echo "##vso[task.setvariable variable=PKG_CONFIG_PATH;]$MONOPREFIX/lib/pkgconfig:$MONOPREFIX/share/pkgconfig:$PKG_CONFIG_PATH" + echo "##vso[task.setvariable variable=PATH;]$MONOPREFIX/bin:$PATH" + displayName: Set Mono Version + condition: and(succeeded(), eq(variables['osName'], 'Mac')) + - checkout: none + - task: DownloadPipelineArtifact@2 + displayName: Download Test Artifact + inputs: + buildType: 'current' + artifactName: WindowsTests + targetPath: $(testsFolder) + - task: DownloadPipelineArtifact@2 + displayName: Download Build Artifact + inputs: + buildType: 'current' + artifactName: Packages + itemPattern: '**/$(pattern)' + targetPath: $(Build.ArtifactStagingDirectory) + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/**/$(pattern)' + destinationFolder: '$(Build.ArtifactStagingDirectory)/bin' + displayName: Extract Package + - bash: | + mkdir -p ./bin/ + cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Radarr/. ./bin/ + displayName: Move Package Contents + - bash: | + sudo apt install dos2unix + dos2unix ${TESTSFOLDER}/test.sh + condition: and(succeeded(), eq(variables['osName'], 'Linux')) + - bash: | + brew install dos2unix + dos2unix ${TESTSFOLDER}/test.sh + condition: and(succeeded(), eq(variables['osName'], 'Mac')) + - task: Bash@3 + displayName: Run Integration Tests + inputs: + targetType: 'filePath' + filePath: '$(testsFolder)/test.sh' + arguments: $(osName) Integration Test + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '**/TestResult.xml' + testRunTitle: '$(osName) Integration Tests' + failTaskOnFailedTests: true + displayName: Publish Test Results + + - job: Automation + strategy: + matrix: + Linux: + osName: 'Linux' + imageName: 'ubuntu-16.04' + pattern: 'Radarr.**.linux.tar.gz' + failBuild: true + Mac: + osName: 'Mac' + imageName: 'macos-10.13' # Fails due to firefox not being installed on image + pattern: 'Radarr.**.osx.tar.gz' + failBuild: false + Windows: + osName: 'Windows' + imageName: 'vs2017-win2016' + pattern: 'Radarr.**.windows.zip' + failBuild: true + + pool: + vmImage: $(imageName) + + steps: + - checkout: none + - task: DownloadPipelineArtifact@2 + displayName: Download Test Artifact + inputs: + buildType: 'current' + artifactName: WindowsTests + targetPath: $(testsFolder) + - task: DownloadPipelineArtifact@2 + displayName: Download Build Artifact + inputs: + buildType: 'current' + artifactName: Packages + itemPattern: '**/$(pattern)' + targetPath: $(Build.ArtifactStagingDirectory) + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/**/$(pattern)' + destinationFolder: '$(Build.ArtifactStagingDirectory)/bin' + displayName: Extract Package + - bash: | + mkdir -p ./bin/ + cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Radarr/. ./bin/ + displayName: Move Package Contents + - bash: | + if [[ $OSNAME == "Mac" ]]; then + url=https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz + elif [[ $OSNAME == "Linux" ]]; then + url=https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz + else + echo "Unhandled OS" + exit 1 + fi + curl -s -L "$url" | tar -xz + chmod +x geckodriver + mv geckodriver _tests + displayName: Install Gecko Driver + condition: and(succeeded(), ne(variables['osName'], 'Windows')) + - bash: ls -lR + - task: Bash@3 + displayName: Run Automation Tests + inputs: + targetType: 'filePath' + filePath: '$(testsFolder)/test.sh' + arguments: $(osName) Automation Test + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '**/TestResult.xml' + testRunTitle: '$(osName) Automation Tests' + failTaskOnFailedTests: $(failBuild) + displayName: Publish Test Results + + # - stage: Analyze + # dependsOn: [] + # displayName: Analyze + # condition: eq(variables['system.pullrequest.isfork'], false) + + # jobs: + # # - job: Analyze_Frontend + # # displayName: Frontend + # # pool: + # # vmImage: vs2017-win2016 + # # steps: + # # - checkout: self # Need history for Sonar analysis + # # - task: SonarCloudPrepare@1 + # # env: + # # SONAR_SCANNER_OPTS: '' + # # inputs: + # # SonarCloud: 'SonarCloud' + # # organization: 'radarr' + # # scannerMode: 'CLI' + # # configMode: 'manual' + # # cliProjectKey: 'radarr_Radarr.UI' + # # cliProjectName: 'RadarrUI' + # # cliProjectVersion: '$(radarrVersion)' + # # cliSources: './frontend' + # # - task: SonarCloudAnalyze@1 + + # - job: Analyze_Backend + # displayName: Backend + # pool: + # vmImage: vs2017-win2016 + # steps: + # - checkout: self # Need history for Sonar analysis + # submodules: true + # - task: SonarCloudPrepare@1 + # inputs: + # SonarCloud: 'SonarCloud' + # organization: 'radarr' + # scannerMode: 'MSBuild' + # projectKey: 'radarr_Radarr' + # projectName: 'Radarr' + # projectVersion: '$(radarrVersion)' + # extraProperties: | + # sonar.exclusions=**/obj/**,**/*.dll,**/NzbDrone.Core.Test/Files/**/*,./frontend/**,**/ExternalModules/**,./src/Libraries/** + # sonar.coverage.exclusions=**/Radarr.Api.V1/**/*,**/MonoTorrent/**/*,**/Marr.Data/**/* + # sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/_tests/CoverageResults/coverage.opencover.xml + # sonar.cs.nunit.reportsPaths=$(Build.SourcesDirectory)/TestResult.xml + # - bash: ./build.sh --only-backend + # displayName: Build Radarr Backend + # - task: Bash@3 + # displayName: Coverage Unit Tests + # inputs: + # targetType: 'filePath' + # filePath: ./test.sh + # arguments: Windows Unit Coverage + # - task: PublishCodeCoverageResults@1 + # displayName: Publish Coverage Results + # inputs: + # codeCoverageTool: 'cobertura' + # summaryFileLocation: './_tests/CoverageResults/coverage.cobertura.xml' + # # - task: SonarCloudAnalyze@1 \ No newline at end of file diff --git a/build-appveyor.cake b/build-appveyor.cake deleted file mode 100644 index 9919bc93e..000000000 --- a/build-appveyor.cake +++ /dev/null @@ -1,323 +0,0 @@ -#addin nuget:?package=Cake.Npm -#addin nuget:?package=SharpZipLib -#addin nuget:?package=Cake.Compression -#addin "Cake.FileHelpers" - -// Build variables -var outputFolder = "./_output"; -var outputFolderMono = outputFolder + "_mono"; -var outputFolderOsx = outputFolder + "_osx"; -var outputFolderOsxApp = outputFolderOsx + "_app"; -var testPackageFolder = "./_tests"; -var testSearchPattern = "*.Test/bin/x86/Release"; -var sourceFolder = "./src"; -var solutionFile = sourceFolder + "/Radarr.sln"; -var updateFolder = outputFolder + "/Radarr.Update"; -var updateFolderMono = outputFolderMono + "/Radarr.Update"; - -// Artifact variables -var artifactsFolder = "./_artifacts"; -var artifactsFolderWindows = artifactsFolder + "/windows"; -var artifactsFolderLinux = artifactsFolder + "/linux"; -var artifactsFolderOsx = artifactsFolder + "/osx"; -var artifactsFolderOsxApp = artifactsFolder + "/osx-app"; - -// Utility methods -public void RemoveEmptyFolders(string startLocation) { - foreach (var directory in System.IO.Directory.GetDirectories(startLocation)) - { - RemoveEmptyFolders(directory); - - if (System.IO.Directory.GetFiles(directory).Length == 0 && - System.IO.Directory.GetDirectories(directory).Length == 0) - { - DeleteDirectory(directory, false); - } - } -} - -public void CleanFolder(string path, bool keepConfigFiles) { - DeleteFiles(path + "/**/*.transform"); - - if (!keepConfigFiles) { - DeleteFiles(path + "/**/*.dll.config"); - } - - DeleteFiles(path + "/**/FluentValidation.resources.dll"); - DeleteFiles(path + "/**/App.config"); - - DeleteFiles(path + "/**/*.less"); - - DeleteFiles(path + "/**/*.vshost.exe"); - - DeleteFiles(path + "/**/*.dylib"); - - RemoveEmptyFolders(path); -} - -public void CreateMdbs(string path) { - foreach (var file in System.IO.Directory.EnumerateFiles(path, "*.pdb", System.IO.SearchOption.AllDirectories)) { - var actualFile = file.Substring(0, file.Length - 4); - - if (FileExists(actualFile + ".exe")) { - StartProcess("./tools/pdb2mdb/pdb2mdb.exe", new ProcessSettings() - .WithArguments(args => args.Append(actualFile + ".exe"))); - } - - if (FileExists(actualFile + ".dll")) { - StartProcess("./tools/pdb2mdb/pdb2mdb.exe", new ProcessSettings() - .WithArguments(args => args.Append(actualFile + ".dll"))); - } - } -} - -// Build Tasks -Task("Compile").Does(() => { - // Build - if (DirectoryExists(outputFolder)) { - DeleteDirectory(outputFolder, true); - } - - MSBuild(solutionFile, config => - config.UseToolVersion(MSBuildToolVersion.VS2017) - .WithTarget("Clean") - .SetVerbosity(Verbosity.Minimal)); - - NuGetRestore(solutionFile); - - MSBuild(solutionFile, config => - config.UseToolVersion(MSBuildToolVersion.VS2017) - .SetPlatformTarget(PlatformTarget.x86) - .SetConfiguration("Release") - .WithProperty("AllowedReferenceRelatedFileExtensions", new string[] { ".pdb" }) - .WithTarget("Build") - .SetVerbosity(Verbosity.Minimal)); - - CleanFolder(outputFolder, false); - - // Add JsonNet - DeleteFiles(outputFolder + "/Newtonsoft.Json.*"); - CopyFiles(sourceFolder + "/packages/Newtonsoft.Json.*/lib/net35/*.dll", outputFolder); - CopyFiles(sourceFolder + "/packages/Newtonsoft.Json.*/lib/net35/*.dll", updateFolder); - - // Remove Mono stuff - DeleteFile(outputFolder + "/Mono.Posix.dll"); -}); - -Task("Gulp").Does(() => { - NpmInstall(new NpmInstallSettings { - LogLevel = NpmLogLevel.Silent, - WorkingDirectory = "./", - Production = true - }); - - NpmRunScript("build"); -}); - -Task("PackageMono").Does(() => { - // Start mono package - if (DirectoryExists(outputFolderMono)) { - DeleteDirectory(outputFolderMono, true); - } - - CopyDirectory(outputFolder, outputFolderMono); - - // Create MDBs - CreateMdbs(outputFolderMono); - - // Remove PDBs - DeleteFiles(outputFolderMono + "/**/*.pdb"); - - // Remove service helpers - DeleteFiles(outputFolderMono + "/ServiceUninstall.*"); - DeleteFiles(outputFolderMono + "/ServiceInstall.*"); - - // Remove native windows binaries - DeleteFiles(outputFolderMono + "/sqlite3.*"); - DeleteFiles(outputFolderMono + "/MediaInfo.*"); - - // Adding Radarr.Core.dll.config (for dllmap) - CopyFile(sourceFolder + "/NzbDrone.Core/Radarr.Core.dll.config", outputFolderMono + "/Radarr.Core.dll.config"); - - // Adding CurlSharp.dll.config (for dllmap) - CopyFile(sourceFolder + "/NzbDrone.Common/CurlSharp.dll.config", outputFolderMono + "/CurlSharp.dll.config"); - - // Renaming Radarr.Console.exe to Radarr.exe - DeleteFiles(outputFolderMono + "/Radarr.exe*"); - MoveFile(outputFolderMono + "/Radarr.Console.exe", outputFolderMono + "/Radarr.exe"); - MoveFile(outputFolderMono + "/Radarr.Console.exe.config", outputFolderMono + "/Radarr.exe.config"); - MoveFile(outputFolderMono + "/Radarr.Console.exe.mdb", outputFolderMono + "/Radarr.exe.mdb"); - - // Remove Radarr.Windows.* - DeleteFiles(outputFolderMono + "/Radarr.Windows.*"); - - // Adding Radarr.Mono to updatePackage - CopyFiles(outputFolderMono + "/Radarr.Mono.*", updateFolderMono); -}); - -Task("PackageOsx").Does(() => { - // Start osx package - if (DirectoryExists(outputFolderOsx)) { - DeleteDirectory(outputFolderOsx, true); - } - - CopyDirectory(outputFolderMono, outputFolderOsx); - - // Adding sqlite dylibs - CopyFiles(sourceFolder + "/Libraries/Sqlite/*.dylib", outputFolderOsx); - - // Adding MediaInfo dylib - CopyFiles(sourceFolder + "/Libraries/MediaInfo/*.dylib", outputFolderOsx); - - // Chmod as executable - StartProcess(@"C:\cygwin64\bin\chmod.exe", new ProcessSettings() - .WithArguments(args => args - .Append("+x") - .Append(outputFolderOsx + "/Radarr"))); - - // Adding Startup script - CopyFile("./osx/Radarr", outputFolderOsx + "/Radarr"); -}); - -Task("PackageOsxApp").Does((ctx) => { - // Start osx app package - if (DirectoryExists(outputFolderOsxApp)) { - DeleteDirectory(outputFolderOsxApp, true); - } - - CreateDirectory(outputFolderOsxApp); - - // Copy osx package files - CopyDirectory("./osx/Radarr.app", outputFolderOsxApp + "/Radarr.app"); - CopyDirectory(outputFolderOsx, outputFolderOsxApp + "/Radarr.app/Contents/MacOS"); - - // Edit version of osx app - ctx.ReplaceTextInFiles(outputFolderOsxApp + "/Radarr.app/Contents/Info.plist", "2.0", ctx.EnvironmentVariable("APPVEYOR_BUILD_VERSION") ?? "unknown"); -}); - -Task("PackageTests").Does(() => { - // Start tests package - if (DirectoryExists(testPackageFolder)) { - DeleteDirectory(testPackageFolder, true); - } - - CreateDirectory(testPackageFolder); - - // Copy tests - CopyFiles(sourceFolder + "/" + testSearchPattern + "/*", testPackageFolder); - foreach (var directory in System.IO.Directory.GetDirectories(sourceFolder, "*.Test")) { - var releaseDirectory = directory + "/bin/x86/Release"; - if (DirectoryExists(releaseDirectory)) { - foreach (var releaseSubDirectory in System.IO.Directory.GetDirectories(releaseDirectory)) { - Information(System.IO.Path.GetDirectoryName(releaseSubDirectory)); - CopyDirectory(releaseSubDirectory, testPackageFolder + "/" + System.IO.Path.GetFileName(releaseSubDirectory)); - } - } - } - - // Install NUnit.ConsoleRunner - NuGetInstall("NUnit.ConsoleRunner", new NuGetInstallSettings { - Version = "3.2.0", - OutputDirectory = testPackageFolder - }); - - // Copy dlls - CopyFiles(outputFolder + "/*.dll", testPackageFolder); - - // Copy scripts - CopyFiles("./*.sh", testPackageFolder); - - // Create MDBs for tests - CreateMdbs(testPackageFolder); - - // Remove config - DeleteFiles(testPackageFolder + "/*.log.config"); - - // Clean - CleanFolder(testPackageFolder, true); - - // Adding Radarr.Core.dll.config (for dllmap) - CopyFile(sourceFolder + "/NzbDrone.Core/Radarr.Core.dll.config", testPackageFolder + "/Radarr.Core.dll.config"); - - // Adding CurlSharp.dll.config (for dllmap) - CopyFile(sourceFolder + "/NzbDrone.Common/CurlSharp.dll.config", testPackageFolder + "/CurlSharp.dll.config"); - - // Adding CurlSharp libraries - CopyFiles(sourceFolder + "/ExternalModules/CurlSharp/libs/i386/*", testPackageFolder); -}); - -Task("CleanupWindowsPackage").Does(() => { - // Remove mono - DeleteFiles(outputFolder + "/Radarr.Mono.*"); - - // Adding NzbDrone.Windows to updatePackage - CopyFiles(outputFolder + "/Radarr.Windows.*", updateFolder); -}); - -Task("Build") - .IsDependentOn("Compile") - .IsDependentOn("Gulp") - .IsDependentOn("PackageMono") - .IsDependentOn("PackageOsx") - .IsDependentOn("PackageOsxApp") - .IsDependentOn("PackageTests") - .IsDependentOn("CleanupWindowsPackage"); - -// Build Artifacts -Task("CleanArtifacts").Does(() => { - if (DirectoryExists(artifactsFolder)) { - DeleteDirectory(artifactsFolder, true); - } - - CreateDirectory(artifactsFolder); -}); - -Task("ArtifactsWindows").Does(() => { - CopyDirectory(outputFolder, artifactsFolderWindows + "/Radarr"); -}); - -Task("ArtifactsWindowsInstaller").Does(() => { - InnoSetup("./setup/radarr.iss", new InnoSetupSettings { - OutputDirectory = artifactsFolder, - ToolPath = "./setup/inno/ISCC.exe" - }); -}); - -Task("ArtifactsLinux").Does(() => { - CopyDirectory(outputFolderMono, artifactsFolderLinux + "/Radarr"); -}); - -Task("ArtifactsOsx").Does(() => { - CopyDirectory(outputFolderOsx, artifactsFolderOsx + "/Radarr"); -}); - -Task("ArtifactsOsxApp").Does(() => { - CopyDirectory(outputFolderOsxApp, artifactsFolderOsxApp); -}); - -Task("CompressArtifacts").Does(() => { - var prefix = ""; - - if (AppVeyor.IsRunningOnAppVeyor) { - prefix += AppVeyor.Environment.Repository.Branch.Replace("/", "-") + "."; - prefix += AppVeyor.Environment.Build.Version + "."; - } - - Zip(artifactsFolderWindows, artifactsFolder + "/Radarr." + prefix + "windows.zip"); - GZipCompress(artifactsFolderLinux, artifactsFolder + "/Radarr." + prefix + "linux.tar.gz"); - GZipCompress(artifactsFolderOsx, artifactsFolder + "/Radarr." + prefix + "osx.tar.gz"); - Zip(artifactsFolderOsxApp, artifactsFolder + "/Radarr." + prefix + "osx-app.zip"); -}); - -Task("Artifacts") - .IsDependentOn("CleanArtifacts") - .IsDependentOn("ArtifactsWindows") - .IsDependentOn("ArtifactsWindowsInstaller") - .IsDependentOn("ArtifactsLinux") - .IsDependentOn("ArtifactsOsx") - .IsDependentOn("ArtifactsOsxApp") - .IsDependentOn("CompressArtifacts"); - -// Run -RunTarget("Build"); -RunTarget("Artifacts"); diff --git a/build-appveyor.ps1 b/build-appveyor.ps1 deleted file mode 100644 index 742cc6808..000000000 --- a/build-appveyor.ps1 +++ /dev/null @@ -1,189 +0,0 @@ -########################################################################## -# This is the Cake bootstrapper script for PowerShell. -# This file was downloaded from https://github.com/cake-build/resources -# Feel free to change this file to fit your needs. -########################################################################## - -<# -.SYNOPSIS -This is a Powershell script to bootstrap a Cake build. -.DESCRIPTION -This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) -and execute your Cake build script with the parameters you provide. -.PARAMETER Script -The build script to execute. -.PARAMETER Target -The build script target to run. -.PARAMETER Configuration -The build configuration to use. -.PARAMETER Verbosity -Specifies the amount of information to be displayed. -.PARAMETER Experimental -Tells Cake to use the latest Roslyn release. -.PARAMETER WhatIf -Performs a dry run of the build script. -No tasks will be executed. -.PARAMETER Mono -Tells Cake to use the Mono scripting engine. -.PARAMETER SkipToolPackageRestore -Skips restoring of packages. -.PARAMETER ScriptArgs -Remaining arguments are added here. -.LINK -http://cakebuild.net -#> - -[CmdletBinding()] -Param( - [string]$Script = "build-appveyor.cake", - [string]$Target = "Default", - [ValidateSet("Release", "Debug")] - [string]$Configuration = "Release", - [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity = "Verbose", - [switch]$Experimental, - [Alias("DryRun","Noop")] - [switch]$WhatIf, - [switch]$Mono, - [switch]$SkipToolPackageRestore, - [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] - [string[]]$ScriptArgs -) - -[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null -function MD5HashFile([string] $filePath) -{ - if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) - { - return $null - } - - [System.IO.Stream] $file = $null; - [System.Security.Cryptography.MD5] $md5 = $null; - try - { - $md5 = [System.Security.Cryptography.MD5]::Create() - $file = [System.IO.File]::OpenRead($filePath) - return [System.BitConverter]::ToString($md5.ComputeHash($file)) - } - finally - { - if ($file -ne $null) - { - $file.Dispose() - } - } -} - -Write-Host "Preparing to run build script..." - -if(!$PSScriptRoot){ - $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent -} - -$TOOLS_DIR = Join-Path $PSScriptRoot "tools" -$NUGET_EXE = Join-Path $TOOLS_DIR "nuget/nuget.exe" -$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" -$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" -$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" - -# Should we use mono? -$UseMono = ""; -if($Mono.IsPresent) { - Write-Verbose -Message "Using the Mono based scripting engine." - $UseMono = "-mono" -} - -# Should we use the new Roslyn? -$UseExperimental = ""; -if($Experimental.IsPresent -and !($Mono.IsPresent)) { - Write-Verbose -Message "Using experimental version of Roslyn." - $UseExperimental = "-experimental" -} - -# Is this a dry run? -$UseDryRun = ""; -if($WhatIf.IsPresent) { - $UseDryRun = "-dryrun" -} - -# Make sure tools folder exists -if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { - Write-Verbose -Message "Creating tools directory..." - New-Item -Path $TOOLS_DIR -Type directory | out-null -} - -# Make sure that packages.config exist. -if (!(Test-Path $PACKAGES_CONFIG)) { - Write-Verbose -Message "Downloading packages.config..." - try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch { - Throw "Could not download packages.config." - } -} - -# Try find NuGet.exe in path if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Trying to find nuget.exe in PATH..." - $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) } - $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 - if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { - Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." - $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName - } -} - -# Try download NuGet.exe if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Downloading NuGet.exe..." - try { - (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) - } catch { - Throw "Could not download NuGet.exe." - } -} - -# Save nuget.exe path to environment to be available to child processed -$ENV:NUGET_EXE = $NUGET_EXE - -# Restore tools from NuGet? -if(-Not $SkipToolPackageRestore.IsPresent) { - Push-Location - Set-Location $TOOLS_DIR - - # Check for changes in packages.config and remove installed tools if true. - [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) - if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or - ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { - Write-Verbose -Message "Missing or changed package.config hash..." - Get-ChildItem -Path $TOOLS_DIR -Recurse -Exclude packages.config | - Select -ExpandProperty FullName | - Where {$_ -notlike (Join-Path $TOOLS_DIR "pdb2mdb*")} | - Where {$_ -notlike (Join-Path $TOOLS_DIR "nuget*")} | - sort length -Descending | - Remove-Item -Recurse - } - - Write-Verbose -Message "Restoring tools from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring NuGet tools." - } - else - { - $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" - } - Write-Verbose -Message ($NuGetOutput | out-string) - Pop-Location -} - -# Make sure that Cake has been installed. -if (!(Test-Path $CAKE_EXE)) { - Throw "Could not find Cake.exe at $CAKE_EXE" -} - -# Start Cake -Write-Host "Running build script..." -Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" -exit $LASTEXITCODE diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 45b8ce783..000000000 --- a/build.ps1 +++ /dev/null @@ -1 +0,0 @@ -Write-Warning "DEPRECATED -- Please use build.sh instead." \ No newline at end of file diff --git a/build.sh b/build.sh index d56874ac1..ffbc62e2d 100755 --- a/build.sh +++ b/build.sh @@ -1,17 +1,25 @@ #! /bin/bash -msBuild='/MSBuild/15.0/Bin' +msBuildVersion='15.0' outputFolder='./_output' -outputFolderMono='./_output_mono' -outputFolderOsx='./_output_osx' -outputFolderOsxApp='./_output_osx_app' +outputFolderLinux='./_output_linux' +outputFolderMacOS='./_output_macos' +outputFolderMacOSApp='./_output_macos_app' testPackageFolder='./_tests/' -testSearchPattern='*.Test/bin/x86/Release' sourceFolder='./src' slnFile=$sourceFolder/Radarr.sln updateFolder=$outputFolder/Radarr.Update -updateFolderMono=$outputFolderMono/Radarr.Update +updateFolderMono=$outputFolderLinux/Radarr.Update + +#Artifact variables +artifactsFolder="./_artifacts"; +artifactsFolderWindows=$artifactsFolder/windows +artifactsFolderLinux=$artifactsFolder/linux +artifactsFolderMacOS=$artifactsFolder/macos +artifactsFolderMacOSApp=$artifactsFolder/macos-app nuget='tools/nuget/nuget.exe'; +vswhere='tools/vswhere/vswhere.exe'; + CheckExitCode() { "$@" @@ -23,12 +31,30 @@ CheckExitCode() return $status } +ProgressStart() +{ + echo "Start '$1'" +} + +ProgressEnd() +{ + echo "Finish '$1'" +} + +UpdateVersionNumber() +{ + if [ "$RADARRVERSION" != "" ]; then + echo "Updating Version Info" + sed -i "s/[0-9.*]\+<\/AssemblyVersion>/$RADARRVERSION<\/AssemblyVersion>/g" ./src/Directory.Build.props + sed -i "s/[\$()A-Za-z-]\+<\/AssemblyConfiguration>/${BUILD_SOURCEBRANCHNAME}<\/AssemblyConfiguration>/g" ./src/Directory.Build.props + fi +} + CleanFolder() { local path=$1 local keepConfigFiles=$2 - find $path -name "*.transform" -exec rm "{}" \; if [ $keepConfigFiles != true ] ; then @@ -39,9 +65,6 @@ CleanFolder() find $path -name "FluentValidation.resources.dll" -exec rm "{}" \; find $path -name "App.config" -exec rm "{}" \; - echo "Removing .less files" - find $path -name "*.less" -exec rm "{}" \; - echo "Removing vshost files" find $path -name "*.vshost.exe" -exec rm "{}" \; @@ -54,53 +77,51 @@ CleanFolder() BuildWithMSBuild() { + installationPath=`$vswhere -latest -products \* -requires Microsoft.Component.MSBuild -property installationPath` + installationPath=${installationPath/C:\\/\/c\/} + installationPath=${installationPath//\\/\/} + msBuild="$installationPath/MSBuild/$msBuildVersion/Bin" + echo $msBuild + export PATH=$msBuild:$PATH - echo $PATH - CheckExitCode MSBuild.exe $slnFile //t:Clean //m + CheckExitCode MSBuild.exe $slnFile //p:Configuration=Debug //p:Platform=x86 //t:Clean //m + CheckExitCode MSBuild.exe $slnFile //p:Configuration=Release //p:Platform=x86 //t:Clean //m + $nuget locals all -clear $nuget restore $slnFile CheckExitCode MSBuild.exe $slnFile //p:Configuration=Release //p:Platform=x86 //t:Build //m //p:AllowedReferenceRelatedFileExtensions=.pdb } -RestoreNuget() -{ - export MONO_IOMAP=case - mono $nuget restore $slnFile -} - -CleanWithXbuild() -{ - export MONO_IOMAP=case - CheckExitCode msbuild /t:Clean $slnFile -} - BuildWithXbuild() { export MONO_IOMAP=case - CheckExitCode msbuild /p:Configuration=Release /p:Platform=x86 /t:Build /p:AllowedReferenceRelatedFileExtensions=.pdb /maxcpucount:3 $slnFile + CheckExitCode msbuild /p:Configuration=Debug /t:Clean $slnFile + CheckExitCode msbuild /p:Configuration=Release /t:Clean $slnFile + mono $nuget locals all -clear + mono $nuget restore $slnFile + CheckExitCode msbuild /p:Configuration=Release /p:Platform=x86 /t:Build /p:AllowedReferenceRelatedFileExtensions=.pdb $slnFile } LintUI() { - echo "ESLint" + ProgressStart 'ESLint' CheckExitCode yarn lint - echo "ESLint" + ProgressEnd 'ESLint' - echo "Stylelint" + ProgressStart 'Stylelint' CheckExitCode yarn stylelint - echo "Stylelint" + ProgressEnd 'Stylelint' } Build() { - echo "Start Build" + ProgressStart 'Build' rm -rf $outputFolder + rm -rf $testPackageFolder if [ $runtime = "dotnet" ] ; then BuildWithMSBuild else - CleanWithXbuild - RestoreNuget BuildWithXbuild fi @@ -109,130 +130,123 @@ Build() echo "Removing Mono.Posix.dll" rm $outputFolder/Mono.Posix.dll - echo "Finish Build" + echo "Adding LICENSE.md" + cp LICENSE.md $outputFolder + + ProgressEnd 'Build' } RunGulp() { - echo "Start yarn install" + ProgressStart 'yarn install' yarn install - echo "Finish yarn install" + ProgressEnd 'yarn install' LintUI - echo "Start Running gulp" + ProgressStart 'Running gulp' CheckExitCode yarn run build --production - echo "Finish 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 - fi + ProgressEnd 'Running gulp' } PackageMono() { - echo "##teamcity[progressStart 'Creating Mono Package']" - rm -rf $outputFolderMono - cp -r $outputFolder $outputFolderMono + ProgressStart 'Creating Mono Package' - echo "Creating MDBs" - CreateMdbs $outputFolderMono + rm -rf $outputFolderLinux - echo "Removing PDBs" - find $outputFolderMono -name "*.pdb" -exec rm "{}" \; + echo "Copying Binaries" + cp -r $outputFolder $outputFolderLinux echo "Removing Service helpers" - rm -f $outputFolderMono/ServiceUninstall.* - rm -f $outputFolderMono/ServiceInstall.* + rm -f $outputFolderLinux/ServiceUninstall.* + rm -f $outputFolderLinux/ServiceInstall.* echo "Removing native windows binaries Sqlite, MediaInfo" - rm -f $outputFolderMono/sqlite3.* - rm -f $outputFolderMono/MediaInfo.* + rm -f $outputFolderLinux/sqlite3.* + rm -f $outputFolderLinux/MediaInfo.* - echo "Adding NzbDrone.Core.dll.config (for dllmap)" - cp $sourceFolder/NzbDrone.Core/Radarr.Core.dll.config $outputFolderMono + echo "Adding Radarr.Core.dll.config (for dllmap)" + cp $sourceFolder/NzbDrone.Core/Radarr.Core.dll.config $outputFolderLinux - echo "Adding CurlSharp.dll.config (for dllmap)" - cp $sourceFolder/NzbDrone.Common/CurlSharp.dll.config $outputFolderMono echo "Renaming Radarr.Console.exe to Radarr.exe" - rm $outputFolderMono/Radarr.exe* - for file in $outputFolderMono/Radarr.Console.exe*; do + rm $outputFolderLinux/Radarr.exe* + for file in $outputFolderLinux/Radarr.Console.exe*; do mv "$file" "${file//.Console/}" done echo "Removing Radarr.Windows" - rm $outputFolderMono/Radarr.Windows.* + rm $outputFolderLinux/Radarr.Windows.* echo "Adding Radarr.Mono to UpdatePackage" - cp $outputFolderMono/Radarr.Mono.* $updateFolderMono + cp $outputFolderLinux/Radarr.Mono.* $updateFolderMono - echo "##teamcity[progressFinish 'Creating Mono Package']" + ProgressEnd 'Creating Mono Package' } -PackageOsx() +PackageMacOS() { - echo "##teamcity[progressStart 'Creating OS X Package']" - rm -rf $outputFolderOsx - cp -r $outputFolderMono $outputFolderOsx + ProgressStart 'Creating MacOS Package' + + rm -rf $outputFolderMacOS + mkdir $outputFolderMacOS + + echo "Adding Startup script" + cp ./macOS/Radarr $outputFolderMacOS + dos2unix $outputFolderMacOS/Radarr + + echo "Copying Binaries" + cp -r $outputFolderLinux/* $outputFolderMacOS echo "Adding sqlite dylibs" - cp $sourceFolder/Libraries/Sqlite/*.dylib $outputFolderOsx + cp $sourceFolder/Libraries/Sqlite/*.dylib $outputFolderMacOS echo "Adding MediaInfo dylib" - cp $sourceFolder/Libraries/MediaInfo/*.dylib $outputFolderOsx + cp $sourceFolder/Libraries/MediaInfo/*.dylib $outputFolderMacOS - echo "Adding Startup script" - cp ./osx/Radarr $outputFolderOsx - - echo "##teamcity[progressFinish 'Creating OS X Package']" + ProgressEnd 'Creating MacOS Package' } -PackageOsxApp() +PackageMacOSApp() { - echo "##teamcity[progressStart 'Creating OS X App Package']" - rm -rf $outputFolderOsxApp - mkdir $outputFolderOsxApp + ProgressStart 'Creating macOS App Package' + + rm -rf $outputFolderMacOSApp + mkdir $outputFolderMacOSApp + cp -r ./macOS/Radarr.app $outputFolderMacOSApp + mkdir -p $outputFolderMacOSApp/Radarr.app/Contents/MacOS + + echo "Adding Startup script" + cp ./macOS/Radarr $outputFolderMacOSApp/Radarr.app/Contents/MacOS + dos2unix $outputFolderMacOSApp/Radarr.app/Contents/MacOS/Radarr + + echo "Copying Binaries" + cp -r $outputFolderLinux/* $outputFolderMacOSApp/Radarr.app/Contents/MacOS - cp -r ./osx/Radarr.app $outputFolderOsxApp - cp -r $outputFolderOsx $outputFolderOsxApp/Radarr.app/Contents/MacOS + echo "Adding sqlite dylibs" + cp $sourceFolder/Libraries/Sqlite/*.dylib $outputFolderMacOSApp/Radarr.app/Contents/MacOS + + echo "Adding MediaInfo dylib" + cp $sourceFolder/Libraries/MediaInfo/*.dylib $outputFolderMacOSApp/Radarr.app/Contents/MacOS - echo "##teamcity[progressFinish 'Creating OS X App Package']" + echo "Removing Update Folder" + rm -r $outputFolderMacOSApp/Radarr.app/Contents/MacOS/Radarr.Update + + ProgressEnd 'Creating macOS App Package' } PackageTests() { - echo "Packaging Tests" - echo "##teamcity[progressStart 'Creating Test Package']" - rm -rf $testPackageFolder - mkdir $testPackageFolder - - find $sourceFolder -path $testSearchPattern -exec cp -r -u -T "{}" $testPackageFolder \; + ProgressStart 'Creating Test Package' if [ $runtime = "dotnet" ] ; then - $nuget install NUnit.Runners -Version 3.9.0 -Output $testPackageFolder + $nuget install NUnit.ConsoleRunner -Version 3.10.0 -Output $testPackageFolder else - mono $nuget install NUnit.Runners -Version 3.9.0 -Output $testPackageFolder + mono $nuget install NUnit.ConsoleRunner -Version 3.10.0 -Output $testPackageFolder fi - cp $outputFolder/*.dll $testPackageFolder - cp ./*.sh $testPackageFolder - - echo "Creating MDBs for tests" - CreateMdbs $testPackageFolder + cp ./test.sh $testPackageFolder rm -f $testPackageFolder/*.log.config @@ -240,23 +254,47 @@ PackageTests() echo "Adding Radarr.Core.dll.config (for dllmap)" cp $sourceFolder/NzbDrone.Core/Radarr.Core.dll.config $testPackageFolder - - echo "Adding CurlSharp.dll.config (for dllmap)" - cp $sourceFolder/NzbDrone.Common/CurlSharp.dll.config $testPackageFolder - echo "Copying CurlSharp libraries" cp $sourceFolder/ExternalModules/CurlSharp/libs/i386/* $testPackageFolder - echo "##teamcity[progressFinish 'Creating Test Package']" + echo "Adding sqlite dylibs" + cp $sourceFolder/Libraries/Sqlite/*.dylib $testPackageFolder + + ProgressEnd 'Creating Test Package' } CleanupWindowsPackage() { + ProgressStart 'Cleaning Windows Package' + echo "Removing Radarr.Mono" rm -f $outputFolder/Radarr.Mono.* echo "Adding Radarr.Windows to UpdatePackage" cp $outputFolder/Radarr.Windows.* $updateFolder + + ProgressEnd 'Cleaning Windows Package' +} + +PackageArtifacts() +{ + echo "Creating Artifact Directories" + + rm -rf $artifactsFolder + mkdir $artifactsFolder + + mkdir $artifactsFolderWindows + mkdir $artifactsFolderMacOS + mkdir $artifactsFolderLinux + mkdir $artifactsFolderWindows/Radarr + mkdir $artifactsFolderMacOS/Radarr + mkdir $artifactsFolderLinux/Radarr + mkdir $artifactsFolderMacOSApp + + cp -r $outputFolder/* $artifactsFolderWindows/Radarr + cp -r $outputFolderMacOSApp/* $artifactsFolderMacOSApp + cp -r $outputFolderMacOS/* $artifactsFolderMacOS/Radarr + cp -r $outputFolderLinux/* $artifactsFolderLinux/Radarr } # Use mono or .net depending on OS @@ -264,9 +302,6 @@ case "$(uname -s)" in CYGWIN*|MINGW32*|MINGW64*|MSYS*) # on windows, use dotnet runtime="dotnet" - vsLoc=$(./tools/vswhere/vswhere.exe -property installationPath) - vsLoc=$(echo "/$vsLoc" | sed -e 's/\\/\//g' -e 's/://') - msBuild="$vsLoc$msBuild" ;; *) # otherwise use mono @@ -274,42 +309,52 @@ case "$(uname -s)" in ;; esac -if [ $# -eq 0 ] - then - Build - RunGulp - PackageMono - PackageOsx - PackageOsxApp - PackageTests - CleanupWindowsPackage -fi - -if [ "$1" = "CleanXbuild" ] -then rm -rf $outputFolder - CleanWithXbuild -fi +POSITIONAL=() +while [[ $# -gt 0 ]] +do +key="$1" -if [ "$1" = "NugetMono" ] -then rm -rf $outputFolder - RestoreNuget -fi +case $key in + --only-backend) + ONLY_BACKEND=YES + shift # past argument + ;; + --only-frontend) + ONLY_FRONTEND=YES + shift # past argument + ;; + --only-packages) + ONLY_PACKAGES=YES + shift # past argument + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; +esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters -if [ "$1" = "Build" ] -then BuildWithXbuild - CleanFolder $outputFolder false - AddJsonNet - rm $outputFolder/Mono.Posix.dll +# Only build backend if we haven't set only-frontend or only-packages +if [ -z "$ONLY_FRONTEND" ] && [ -z "$ONLY_PACKAGES" ]; +then + UpdateVersionNumber + Build + PackageTests fi -if [ "$1" = "Gulp" ] -then RunGulp +# Only build frontend if we haven't set only-backend or only-packages +if [ -z "$ONLY_BACKEND" ] && [ -z "$ONLY_PACKAGES" ]; +then + RunGulp fi -if [ "$1" = "Package" ] -then PackageMono - PackageOsx - PackageOsxApp - PackageTests - CleanupWindowsPackage +# Only package if we haven't set only-backend or only-frontend +if [ -z "$ONLY_BACKEND" ] && [ -z "$ONLY_FRONTEND" ]; +then + PackageMono + PackageMacOS + PackageMacOSApp + CleanupWindowsPackage + PackageArtifacts fi diff --git a/deploy.sh b/deploy.sh deleted file mode 100644 index 7ad83a091..000000000 --- a/deploy.sh +++ /dev/null @@ -1,7 +0,0 @@ -if [ -z "$CIRCLE_PULL_REQUEST" ]; then - echo "We are building a normal branch, deploying as such..." - curl "http://pr.radarr.video:4466/deploy?url=https%3A%2F%2F${CIRCLE_BUILD_NUM}-77323220-gh.circle-artifacts.com%2F0%2Fartifacts%2FRadarr.${CIRCLE_BRANCH//\//-}.$BUILD_VERSION.$CIRCLE_BUILD_NUM.linux.tar.gz&b=branch&name=${CIRCLE_BRANCH}" -else - echo "We are building a pr, deploying as such..." - curl "http://pr.radarr.video:4466/deploy?url=https%3A%2F%2F${CIRCLE_BUILD_NUM}-77323220-gh.circle-artifacts.com%2F0%2Fartifacts%2FRadarr.${CIRCLE_BRANCH//\//-}.$BUILD_VERSION.$CIRCLE_BUILD_NUM.linux.tar.gz&b=pr&name=${CIRCLE_PR_NUMBER}" -fi \ No newline at end of file diff --git a/osx/Radarr b/macOS/Radarr similarity index 100% rename from osx/Radarr rename to macOS/Radarr diff --git a/osx/Radarr.app/Contents/Info.plist b/macOS/Radarr.app/Contents/Info.plist similarity index 100% rename from osx/Radarr.app/Contents/Info.plist rename to macOS/Radarr.app/Contents/Info.plist diff --git a/osx/Radarr.app/Contents/Resources/radarr.icns b/macOS/Radarr.app/Contents/Resources/radarr.icns similarity index 100% rename from osx/Radarr.app/Contents/Resources/radarr.icns rename to macOS/Radarr.app/Contents/Resources/radarr.icns diff --git a/package.sh b/package.sh deleted file mode 100644 index 8deee34c7..000000000 --- a/package.sh +++ /dev/null @@ -1,77 +0,0 @@ -if [ $# -eq 0 ]; then - if [ "$TRAVIS_PULL_REQUEST" != false ]; then - echo "Need to supply version argument" && exit; - fi -fi - -# Use mono or .net depending on OS -case "$(uname -s)" in - CYGWIN*|MINGW32*|MINGW64*|MSYS*) - # on windows, use dotnet - runtime="dotnet" - ;; - *) - # otherwise use mono - runtime="mono" - ;; -esac - -if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then - VERSION="$(date +%H:%M:%S)" - YEAR="$(date +%Y)" - MONTH="$(date +%m)" - DAY="$(date +%d)" -else - VERSION=$1 - BRANCH=$2 - BRANCH=${BRANCH#refs\/heads\/} - BRANCH=${BRANCH//\//-} -fi -outputFolder='./_output' -outputFolderMono='./_output_mono' -outputFolderOsx='./_output_osx' -outputFolderOsxApp='./_output_osx_app' - -tr -d "\r" < $outputFolderOsxApp/Radarr.app/Contents/MacOS/Radarr > $outputFolderOsxApp/Radarr.app/Contents/MacOS/Radarr2 -rm $outputFolderOsxApp/Radarr.app/Contents/MacOS/Radarr -chmod +x $outputFolderOsxApp/Radarr.app/Contents/MacOS/Radarr2 -mv $outputFolderOsxApp/Radarr.app/Contents/MacOS/Radarr2 $outputFolderOsxApp/Radarr.app/Contents/MacOS/Radarr >& error.log - -if [ $runtime = "dotnet" ] ; then - ./tools/7zip/7za.exe a Radarr_Windows_$VERSION.zip ./Radarr_Windows_$VERSION/* - ./tools/7zip/7za.exe a -ttar -so Radarr_Mono_$VERSION.tar ./Radarr_Mono_$VERSION/* | ./tools/7zip/7za.exe a -si Radarr_Mono_$VERSION.tar.gz - ./tools/7zip/7za.exe a -ttar -so Radarr_OSX_$VERSION.tar ./_output_osx/* | ./tools/7zip/7za.exe a -si Radarr_OSX_$VERSION.tar.gz - ./tools/7zip/7za.exe a -ttar -so Radarr_OSX_App_$VERSION.tar ./_output_osx_app/* | ./tools/7zip/7za.exe a -si Radarr_OSX_App_$VERSION.tar.gz -else - cp -r $outputFolder/ Radarr - zip -r Radarr.$BRANCH.$VERSION.windows.zip Radarr - rm -rf Radarr - cp -r $outputFolderMono/ Radarr - tar -zcvf Radarr.$BRANCH.$VERSION.linux.tar.gz Radarr - rm -rf Radarr - cp -r $outputFolderOsx/ Radarr - tar -zcvf Radarr.$BRANCH.$VERSION.osx.tar.gz Radarr - rm -rf Radarr - #TODO update for tar.gz - - cd _output_osx_app/ - zip -r ../Radarr.$BRANCH.$VERSION.osx-app.zip * -fi -# ftp -n ftp.leonardogalli.ch << END_SCRIPT -# passive -# quote USER $FTP_USER -# quote PASS $FTP_PASS -# mkdir builds -# cd builds -# mkdir $YEAR -# cd $YEAR -# mkdir $MONTH -# cd $MONTH -# mkdir $DAY -# cd $DAY -# binary -# put Radarr_Windows_$VERSION.zip -# put Radarr_Mono_$VERSION.zip -# put Radarr_OSX_$VERSION.zip -# quit -# END_SCRIPT diff --git a/setup/radarr.iss b/setup/radarr.iss index 5845e082b..652638ac5 100644 --- a/setup/radarr.iss +++ b/setup/radarr.iss @@ -4,18 +4,12 @@ #define AppName "Radarr" #define AppPublisher "Team Radarr" #define AppURL "https://radarr.video/" -#define ForumsURL "https://github.com/Radarr/Radarr/issues" +#define ForumsURL "https://forums.radarr.video/" #define AppExeName "Radarr.exe" -#define BuildNumber "2.0" -#define BuildVersion GetEnv('APPVEYOR_BUILD_VERSION') -#define BranchName StringChange(GetEnv('APPVEYOR_REPO_BRANCH'), "/", "-") - -#if BuildVersion == "" - -#define BuildVersion GetEnv('BUILD_VERSION') + GetEnv('$CIRCLE_BUILD_NUM') -#define BranchName StringChange(GetEnv('CIRCLE_BRANCH'), "/", "-") - -#endif +#define BaseVersion "2.0.0" +#define BuildNumber GetEnv('MINORVERSION') +#define BuildVersion GetEnv('RADARRVERSION') +#define BranchName GetEnv('BUILD_SOURCEBRANCHNAME') [Setup] ; NOTE: The value of AppId uniquely identifies this application. @@ -23,7 +17,7 @@ ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{56C1065D-3523-4025-B76D-6F73F67F7F82} AppName={#AppName} -AppVersion=2.0 +AppVersion={#BaseVersion} AppPublisher={#AppPublisher} AppPublisherURL={#AppURL} AppSupportURL={#ForumsURL} @@ -32,7 +26,7 @@ DefaultDirName={commonappdata}\Radarr\bin DisableDirPage=yes DefaultGroupName={#AppName} DisableProgramGroupPage=yes -OutputBaseFilename=Radarr.{#BranchName}.{#BuildVersion}.installer +OutputBaseFilename=Radarr.{#BranchName}.{#BuildVersion}.windows SolidCompression=yes AppCopyright=Creative Commons 3.0 License AllowUNCPath=False @@ -41,18 +35,17 @@ DisableReadyPage=True CompressionThreads=2 Compression=lzma2/normal AppContact={#ForumsURL} -VersionInfoVersion={#BuildNumber} +VersionInfoVersion={#BaseVersion}.{#BuildNumber} [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}" -Name: "windowsService"; Description: "Install Windows Service (Starts when the computer starts)"; GroupDescription: "Start automatically"; Flags: exclusive unchecked -Name: "startupShortcut"; Description: "Create shortcut in Startup folder (Starts when you log into Windows)"; GroupDescription: "Start automatically"; Flags: exclusive +Name: "windowsService"; Description: "Install Windows Service (Starts when the computer starts)"; GroupDescription: "Start automatically"; Flags: exclusive +Name: "startupShortcut"; Description: "Create shortcut in Startup folder (Starts when you log into Windows)"; GroupDescription: "Start automatically"; Flags: exclusive unchecked Name: "none"; Description: "Do not start automatically"; GroupDescription: "Start automatically"; Flags: exclusive unchecked - [Files] Source: "..\_output\Radarr.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "..\_output\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs @@ -71,4 +64,12 @@ Filename: "{app}\Radarr.exe"; Description: "Open Radarr Web UI"; Flags: postinst Filename: "{app}\Radarr.exe"; Description: "Start Radarr"; Flags: postinstall skipifsilent nowait; Tasks: startupShortcut none; [UninstallRun] -Filename: "{app}\Radarr.Console.exe"; Parameters: "/u"; Flags: waituntilterminated skipifdoesntexist +Filename: "{app}\radarr.console.exe"; Parameters: "/u"; Flags: waituntilterminated skipifdoesntexist + +[Code] +function PrepareToInstall(var NeedsRestart: Boolean): String; +var + ResultCode: Integer; +begin + Exec(ExpandConstant('{commonappdata}\Radarr\bin\Radarr.Console.exe'), '/u', '', 0, ewWaitUntilTerminated, ResultCode) +end; diff --git a/sonarr.icns b/sonarr.icns deleted file mode 100644 index 5284eec97..000000000 Binary files a/sonarr.icns and /dev/null differ diff --git a/src/Directory.Build.props b/src/Directory.Build.props index fa4746225..c437d8012 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -74,4 +74,4 @@ $(MSBuildProjectName.Replace('Radarr','NzbDrone')) - \ No newline at end of file + diff --git a/test.ps1 b/test.ps1 deleted file mode 100644 index 8d9447965..000000000 --- a/test.ps1 +++ /dev/null @@ -1,40 +0,0 @@ -# Available types: -# - Unit -# - Integration -# - Automation - -param([string]$type = "Unit") - -$where = "cat != ManualTest && cat != LINUX" -$testDir = "." -$testPattern = "*Test.dll" - -$nunit = "nunit3-console.exe" -$nunitCommand = $nunit - -if (!(Get-Command $nunit -ErrorAction SilentlyContinue)) { - Write-Error "nunit3-console.exe was not found in your PATH, please install https://github.com/nunit/nunit-console/releases." - exit -} - -switch ($type) { - "unit" { - $where = $where + " && cat != IntegrationTest && cat != AutomationTest" - } - "integration" { - $where = $where + " && cat == IntegrationTest" - } - "automation" { - $where = $where + " && cat == AutomationTest" - } - Default { - Write-Error "Invalid test type specified." - exit - } -} - -$assemblies = (Get-ChildItem -Path $testDir -Filter $testPattern -Recurse -File -Name) -join " " - -$command = $nunitCommand + " --where '" + $where + "' " + $assemblies - -Invoke-Expression $command \ No newline at end of file diff --git a/test.sh b/test.sh index 3835ee1fc..e710d9f06 100755 --- a/test.sh +++ b/test.sh @@ -1,24 +1,48 @@ +#! /bin/bash PLATFORM=$1 TYPE=$2 +COVERAGE=$3 WHERE="cat != ManualTest" -TEST_DIR="." TEST_PATTERN="*Test.dll" ASSEMBLIES="" +TEST_LOG_FILE="TestLog.txt" + +echo "test dir: $TEST_DIR" +if [ -z "$TEST_DIR" ]; then + TEST_DIR="." +fi if [ -d "$TEST_DIR/_tests" ]; then TEST_DIR="$TEST_DIR/_tests" fi -NUNIT="$TEST_DIR/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe" +COVERAGE_RESULT_DIRECTORY="$TEST_DIR/CoverageResults/" + +rm -f "$TEST_LOG_FILE" + +# Uncomment to log test output to a file instead of the console +export RADARR_TESTS_LOG_OUTPUT="File" + +NUNIT="$TEST_DIR/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe" NUNIT_COMMAND="$NUNIT" -NUNIT_PARAMS="--result=$TEST_DIR/reports/junit/results-$TYPE.xml;transform=.circleci/nunit3-junit.xslt --agents=12 --config=Debug" +NUNIT_PARAMS="--workers=1" + +if [ "$PLATFORM" = "Mac" ]; then + + export DYLD_FALLBACK_LIBRARY_PATH="$TEST_DIR:/usr/local/lib:/lib:/usr/lib" + echo $LD_LIBRARY_PATH + echo $DYLD_LIBRARY_PATH + echo $DYLD_FALLBACK_LIBRARY_PATH + + # To debug which libraries are being loaded: + # export DYLD_PRINT_LIBRARIES=YES +fi if [ "$PLATFORM" = "Windows" ]; then + mkdir -p "$ProgramData/Radarr" WHERE="$WHERE && cat != LINUX" -elif [ "$PLATFORM" = "Linux" ]; then - WHERE="$WHERE && cat != WINDOWS" - NUNIT_COMMAND="mono --debug $NUNIT" -elif [ "$PLATFORM" = "Mac" ]; then +elif [ "$PLATFORM" = "Linux" ] || [ "$PLATFORM" = "Mac" ] ; then + mkdir -p ~/.config/Radarr WHERE="$WHERE && cat != WINDOWS" NUNIT_COMMAND="mono --debug --runtime=v4.0 $NUNIT" else @@ -41,12 +65,28 @@ for i in `find $TEST_DIR -name "$TEST_PATTERN"`; do ASSEMBLIES="$ASSEMBLIES $i" done -$NUNIT_COMMAND --where "$WHERE" $NUNIT_PARAMS $ASSEMBLIES; -EXIT_CODE=$? +if [ "$COVERAGE" = "Coverage" ]; then + if [ "$PLATFORM" = "Windows" ] || [ "$PLATFORM" = "Linux" ]; then + dotnet tool install coverlet.console --tool-path="$TEST_DIR/coverlet/" + mkdir $COVERAGE_RESULT_DIRECTORY + OPEN_COVER="$TEST_DIR/coverlet/coverlet" + $OPEN_COVER "$TEST_DIR/" --verbosity "detailed" --format "cobertura" --format "opencover" --output "$COVERAGE_RESULT_DIRECTORY" --exclude "[Radarr.*.Test]*" --exclude "[Radarr.Test.*]*" --exclude "[Radarr.Api*]*" --exclude "[Marr.Data]*" --exclude "[MonoTorrent]*" --exclude "[CurlSharp]*" --target "$NUNIT" --targetargs "$NUNIT_PARAMS --where=\"$WHERE\" $ASSEMBLIES"; + EXIT_CODE=$? + else + echo "Coverage only supported on Windows and Linux" + exit 3 + fi +elif [ "$COVERAGE" = "Test" ] ; then + $NUNIT_COMMAND --where "$WHERE" $NUNIT_PARAMS $ASSEMBLIES; + EXIT_CODE=$? +else + echo "Run Type must be provided as third argument: Coverage or Test" + exit 3 +fi if [ "$EXIT_CODE" -ge 0 ]; then echo "Failed tests: $EXIT_CODE" - exit $EXIT_CODE + exit 0 else exit $EXIT_CODE fi diff --git a/tools/desktop.ini b/tools/desktop.ini deleted file mode 100644 index ab17096ea..000000000 --- a/tools/desktop.ini +++ /dev/null @@ -1,4 +0,0 @@ -[ViewState] -Mode= -Vid= -FolderType=Documents