diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3dd7a2920..39e62bca9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -54,7 +54,7 @@ stages: - checkout: self submodules: true fetchDepth: 1 - - bash: ./build.sh --only-backend + - bash: ./build.sh --backend displayName: Build Lidarr Backend - publish: $(outputFolder) artifact: '$(osName)Backend' @@ -66,11 +66,11 @@ stages: condition: and(succeeded(), eq(variables['osName'], 'Windows')) - stage: Build_Frontend - displayName: Build Frontend + displayName: Frontend dependsOn: [] jobs: - - job: Frontend + - job: Build strategy: matrix: Linux: @@ -92,7 +92,7 @@ stages: - checkout: self submodules: true fetchDepth: 1 - - bash: ./build.sh --only-frontend + - bash: ./build.sh --frontend displayName: Build Lidarr Frontend env: FORCE_COLOR: 0 @@ -101,7 +101,7 @@ stages: displayName: Publish Frontend condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - stage: Package + - stage: Installer dependsOn: - Build_Backend - Build_Frontend @@ -125,7 +125,7 @@ stages: artifactName: WindowsFrontend targetPath: _output displayName: Fetch Frontend - - bash: ./build.sh --only-packages + - bash: ./build.sh --packages displayName: Create Packages - bash: | ./setup/inno/ISCC.exe "./setup/lidarr.iss" @@ -134,7 +134,12 @@ stages: - publish: $(Build.ArtifactStagingDirectory) artifact: 'WindowsInstaller' displayName: Publish Installer - + + - stage: Packages + dependsOn: + - Build_Backend + - Build_Frontend + jobs: - job: Other_Packages displayName: Create Standard Packages pool: @@ -154,7 +159,7 @@ stages: artifactName: WindowsFrontend targetPath: _output displayName: Fetch Frontend - - bash: ./build.sh --only-packages + - bash: ./build.sh --packages displayName: Create Packages - bash: | chmod a+x $(artifactsFolder)/macos/Lidarr/fpcalc @@ -514,6 +519,31 @@ stages: condition: eq(variables['system.pullrequest.isfork'], false) jobs: + - job: Lint_Frontend + displayName: Lint Frontend + strategy: + matrix: + Linux: + osName: 'Linux' + imageName: 'ubuntu-16.04' + 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 --lint + displayName: Lint Lidarr Frontend + env: + FORCE_COLOR: 0 + - job: Analyze_Frontend displayName: Frontend pool: @@ -554,7 +584,7 @@ stages: sonar.coverage.exclusions=**/Lidarr.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 + - bash: ./build.sh --backend displayName: Build Lidarr Backend - task: Bash@3 displayName: Coverage Unit Tests diff --git a/build.sh b/build.sh index e929481a1..7a34527c7 100755 --- a/build.sh +++ b/build.sh @@ -141,15 +141,16 @@ Build() ProgressEnd 'Build' } -RunGulp() +YarnInstall() { ProgressStart 'yarn install' yarn install #npm-cache install npm || CheckExitCode npm install --no-optional --no-bin-links ProgressEnd 'yarn install' +} - LintUI - +RunGulp() +{ ProgressStart 'Running gulp' CheckExitCode yarn run build --production ProgressEnd 'Running gulp' @@ -305,21 +306,41 @@ case "$(uname -s)" in esac POSITIONAL=() + +if [ $# -eq 0 ]; then + echo "No arguments provided, building everything" + BACKEND=YES + FRONTEND=YES + PACKAGES=YES + LINT=YES +fi + while [[ $# -gt 0 ]] do key="$1" case $key in - --only-backend) - ONLY_BACKEND=YES + --backend) + BACKEND=YES shift # past argument ;; - --only-frontend) - ONLY_FRONTEND=YES + --frontend) + FRONTEND=YES shift # past argument ;; - --only-packages) - ONLY_PACKAGES=YES + --packages) + PACKAGES=YES + shift # past argument + ;; + --lint) + LINT=YES + shift # past argument + ;; + --all) + BACKEND=YES + FRONTEND=YES + PACKAGES=YES + LINT=YES shift # past argument ;; *) # unknown option @@ -330,22 +351,30 @@ esac done set -- "${POSITIONAL[@]}" # restore positional parameters -# Only build backend if we haven't set only-frontend or only-packages -if [ -z "$ONLY_FRONTEND" ] && [ -z "$ONLY_PACKAGES" ]; +if [ "$BACKEND" == "YES" ]; then UpdateVersionNumber Build PackageTests fi -# Only build frontend if we haven't set only-backend or only-packages -if [ -z "$ONLY_BACKEND" ] && [ -z "$ONLY_PACKAGES" ]; +if [ "$FRONTEND" == "YES" ]; then - RunGulp + YarnInstall + RunGulp +fi + +if [ "$LINT" == "YES" ]; +then + if [ -z "$FRONTEND" ]; + then + YarnInstall + fi + + LintUI fi -# Only package if we haven't set only-backend or only-frontend -if [ -z "$ONLY_BACKEND" ] && [ -z "$ONLY_FRONTEND" ]; +if [ "$PACKAGES" == "YES" ]; then UpdateVersionNumber PackageMono