orchard/azure-pipelines.yml
2023-05-10 18:20:43 +03:00

129 lines
3.9 KiB
YAML

# Cider-1 Azure Pipeline Workflow
# Maintained by Cider Devops.
# Don't make changes unless you know what you're doing.
trigger:
branches:
include:
- main
paths:
include:
- src/**/*
- azure-pipelines.yml
variables:
COMMIT_URL: "$(Build.Repository.Uri)/commit/$(Build.SourceVersion)"
BUILD_URL: "$(System.CollectionUri)/$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)"
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn/cache
YARN_ENABLE_IMMUTABLE_INSTALLS: false
jobs:
# Linux Production Build Test
# This job is used to test the production build of the Linux distribution.
# Also tests Pull Requests.
- job: compile_linux
displayName: "Compile Linux Distribution"
pool: Linux
steps:
- task: NodeTool@0
displayName: "Install Node.js"
inputs:
versionSource: "fromFile"
versionFilePath: ".nvmrc"
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
path: $(YARN_CACHE_FOLDER)
displayName: Cache yarn
- script: |
yarn set version from sources
displayName: "Setup yarn"
# Install dependencies (immutable for non-PR builds)
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- script: yarn install --immutable-cache
displayName: "Install Dependencies"
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- script: yarn install
displayName: "Install Dependencies"
- script: yarn dist:linux
displayName: "Compile Distribution"
- task: CopyFiles@2
displayName: "Copy to artifacts staging directory"
inputs:
SourceFolder: "dist"
Contents: "*.AppImage"
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: Upload Artifacts
inputs:
ArtifactName: "Cider-2"
publishLocation: "Container"
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(System.ArtifactsDirectory)'
# Windows Production Build Test
# This job is used to test the production build of the Windows distribution.
# Also tests Pull Requests.
- job: compile_windows
displayName: "Compile Windows Distribution"
pool: Linux
steps:
- task: NodeTool@0
displayName: "Install Node.js"
inputs:
versionSource: "fromFile"
versionFilePath: ".nvmrc"
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
path: $(YARN_CACHE_FOLDER)
displayName: Cache yarn
- script: |
yarn set version from sources
displayName: "Setup yarn"
# Install dependencies (immutable for non-PR builds)
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- script: yarn install --immutable
displayName: "Install Dependencies"
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- script: yarn install
displayName: "Install Dependencies"
- script: yarn dist:win
displayName: "Compile Distribution"
- task: CopyFiles@2
displayName: "Copy to artifacts staging directory"
inputs:
SourceFolder: "dist"
Contents: "*.exe"
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: Upload Artifacts
inputs:
ArtifactName: "Cider-2"
publishLocation: "Container"
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(System.ArtifactsDirectory)'