1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-23 08:13:01 +00:00

Cache Yarn Packages on build

This commit is contained in:
Qstick 2020-09-06 21:38:01 -04:00
parent 09ebfe0af8
commit 8abff4a2bc

View file

@ -14,6 +14,7 @@ variables:
sentryOrg: 'servarr' sentryOrg: 'servarr'
sentryUrl: 'https://sentry.servarr.com' sentryUrl: 'https://sentry.servarr.com'
dotnetVersion: '3.1.401' dotnetVersion: '3.1.401'
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
trigger: trigger:
branches: branches:
@ -25,9 +26,32 @@ pr:
- develop - develop
stages: stages:
- stage: Setup
displayName: Setup
jobs:
- job:
displayName: Build Variables
pool:
vmImage: 'ubuntu-18.04'
steps:
# Set the build name properly. The 'name' property won't recursively expand so hack here:
- bash: echo "##vso[build.updatebuildnumber]$LIDARRVERSION"
displayName: Set Build Name
- bash: |
if [[ $BUILD_REASON == "PullRequest" ]]; then
git diff origin/develop...HEAD --name-only | grep -E "^(src/|azure-pipelines.yml)"
echo $? > not_backend_update
else
echo 0 > not_backend_update
fi
cat not_backend_update
displayName: Check for Backend File Changes
- publish: not_backend_update
artifact: not_backend_update
displayName: Publish update type
- stage: Build_Backend - stage: Build_Backend
displayName: Build Backend displayName: Build Backend
dependsOn: Setup
jobs: jobs:
- job: Backend - job: Backend
strategy: strategy:
@ -48,9 +72,6 @@ stages:
# Disable stylecop here - linting errors get caught by the analyze task # Disable stylecop here - linting errors get caught by the analyze task
EnableAnalyzers: 'false' EnableAnalyzers: 'false'
steps: steps:
# Set the build name properly. The 'name' property won't recursively expand so hack here:
- powershell: Write-Host "##vso[build.updatebuildnumber]$($env:LIDARRVERSION)"
displayName: Set Build Name
- checkout: self - checkout: self
submodules: true submodules: true
fetchDepth: 1 fetchDepth: 1
@ -77,7 +98,7 @@ stages:
condition: and(succeeded(), eq(variables['osName'], 'Windows')) condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- publish: '$(testsFolder)/net462/linux-x64/publish' - publish: '$(testsFolder)/net462/linux-x64/publish'
artifact: LinuxTests artifact: LinuxTests
displayName: Publish Linux Test Package displayName: Publish Linux Mono Test Package
condition: and(succeeded(), eq(variables['osName'], 'Windows')) condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- publish: '$(testsFolder)/netcoreapp3.1/linux-x64/publish' - publish: '$(testsFolder)/netcoreapp3.1/linux-x64/publish'
artifact: LinuxCoreTests artifact: LinuxCoreTests
@ -94,8 +115,7 @@ stages:
- stage: Build_Frontend - stage: Build_Frontend
displayName: Frontend displayName: Frontend
dependsOn: [] dependsOn: Setup
jobs: jobs:
- job: Build - job: Build
strategy: strategy:
@ -119,10 +139,19 @@ stages:
- checkout: self - checkout: self
submodules: true submodules: true
fetchDepth: 1 fetchDepth: 1
- task: Cache@2
inputs:
key: 'yarn | "$(osName)" | yarn.lock'
restoreKeys: |
yarn | "$(osName)"
yarn
path: $(yarnCacheFolder)
displayName: Cache Yarn packages
- bash: ./build.sh --frontend - bash: ./build.sh --frontend
displayName: Build Lidarr Frontend displayName: Build Lidarr Frontend
env: env:
FORCE_COLOR: 0 FORCE_COLOR: 0
YARN_CACHE_FOLDER: $(yarnCacheFolder)
- publish: $(outputFolder) - publish: $(outputFolder)
artifact: '$(osName)Frontend' artifact: '$(osName)Frontend'
displayName: Publish Frontend displayName: Publish Frontend
@ -299,8 +328,24 @@ stages:
dependsOn: Build_Backend dependsOn: Build_Backend
condition: succeeded() condition: succeeded()
jobs: jobs:
- job: Prepare
pool:
vmImage: 'ubuntu-18.04'
steps:
- checkout: none
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'not_backend_update'
targetPath: '.'
- bash: echo "##vso[task.setvariable variable=backendNotUpdated;isOutput=true]$(cat not_backend_update)"
name: setVar
- job: Unit - job: Unit
displayName: Unit Native displayName: Unit Native
dependsOn: Prepare
condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0'))
strategy: strategy:
matrix: matrix:
MacCore: MacCore:
@ -369,12 +414,10 @@ stages:
- job: Unit_Docker - job: Unit_Docker
displayName: Unit Docker displayName: Unit Docker
dependsOn: Prepare
condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0'))
strategy: strategy:
matrix: matrix:
mono508:
testName: 'Mono 5.8'
artifactName: LinuxTests
containerImage: servarr/testimages:mono-5.8
mono520: mono520:
testName: 'Mono 5.20' testName: 'Mono 5.20'
artifactName: LinuxTests artifactName: LinuxTests
@ -431,9 +474,23 @@ stages:
displayName: Integration displayName: Integration
dependsOn: Packages dependsOn: Packages
jobs: jobs:
- job: Prepare
pool:
vmImage: 'ubuntu-18.04'
steps:
- checkout: none
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'not_backend_update'
targetPath: '.'
- bash: echo "##vso[task.setvariable variable=backendNotUpdated;isOutput=true]$(cat not_backend_update)"
name: setVar
- job: Integration_Native - job: Integration_Native
displayName: Integration Native displayName: Integration Native
dependsOn: Prepare
condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0'))
strategy: strategy:
matrix: matrix:
MacCore: MacCore:
@ -505,13 +562,10 @@ stages:
- job: Integration_Docker - job: Integration_Docker
displayName: Integration Docker displayName: Integration Docker
dependsOn: Prepare
condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0'))
strategy: strategy:
matrix: matrix:
mono508:
testName: 'Mono 5.8'
artifactName: LinuxTests
containerImage: servarr/testimages:mono-5.8
pattern: 'Lidarr.**.linux.tar.gz'
mono520: mono520:
testName: 'Mono 5.20' testName: 'Mono 5.20'
artifactName: LinuxTests artifactName: LinuxTests
@ -652,7 +706,7 @@ stages:
- bash: | - bash: |
chmod a+x ${TESTSFOLDER}/test.sh chmod a+x ${TESTSFOLDER}/test.sh
${TESTSFOLDER}/test.sh ${OSNAME} Automation Test ${TESTSFOLDER}/test.sh ${OSNAME} Automation Test
displayName: Run Integration Tests displayName: Run Automation Tests
- task: PublishTestResults@2 - task: PublishTestResults@2
inputs: inputs:
testResultsFormat: 'NUnit' testResultsFormat: 'NUnit'
@ -662,9 +716,23 @@ stages:
displayName: Publish Test Results displayName: Publish Test Results
- stage: Analyze - stage: Analyze
dependsOn: [] dependsOn:
- Setup
displayName: Analyze displayName: Analyze
jobs: jobs:
- job: Prepare
pool:
vmImage: 'ubuntu-18.04'
steps:
- checkout: none
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'not_backend_update'
targetPath: '.'
- bash: echo "##vso[task.setvariable variable=backendNotUpdated;isOutput=true]$(cat not_backend_update)"
name: setVar
- job: Lint_Frontend - job: Lint_Frontend
displayName: Lint Frontend displayName: Lint Frontend
strategy: strategy:
@ -685,10 +753,19 @@ stages:
- checkout: self - checkout: self
submodules: true submodules: true
fetchDepth: 1 fetchDepth: 1
- task: Cache@2
inputs:
key: 'yarn | "$(osName)" | yarn.lock'
restoreKeys: |
yarn | "$(osName)"
yarn
path: $(yarnCacheFolder)
displayName: Cache Yarn packages
- bash: ./build.sh --lint - bash: ./build.sh --lint
displayName: Lint Lidarr Frontend displayName: Lint Lidarr Frontend
env: env:
FORCE_COLOR: 0 FORCE_COLOR: 0
YARN_CACHE_FOLDER: $(yarnCacheFolder)
- job: Analyze_Frontend - job: Analyze_Frontend
displayName: Frontend displayName: Frontend
@ -713,6 +790,9 @@ stages:
- job: Analyze_Backend - job: Analyze_Backend
displayName: Backend displayName: Backend
dependsOn: Prepare
condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0'))
variables: variables:
disable.coverage.autogenerate: 'true' disable.coverage.autogenerate: 'true'
pool: pool: