-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
125 lines (108 loc) · 4.56 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
# Node.js
# This section defines the Azure Pipeline configuration for a Node.js project.
# It includes instructions for building the project using npm and saving the build artifacts.
# The trigger section specifies which branches will trigger the pipeline when new commits are pushed.
trigger:
branches:
include:
- "master"
tags:
include:
- "release/**"
- "qa/**"
- "dev/**"
# The pool section specifies the agent pool that will run the jobs in this pipeline.
# 'Default' is typically the name of the Microsoft-hosted agent pool provided by Azure DevOps.
pool:
name: Default
# The stages section allows you to organize the pipeline into multiple stages.
# Here we have only one stage named 'build', which contains the jobs for building the project.
stages:
- stage: build
# Within the build stage, we define the jobs that need to be run.
# Each job runs independently and can run on different agents if required.
# The 'build' stage is responsible for executing tasks that compile and build the code.
jobs:
- job: installAndBuild
displayName: Install and Build
steps:
# Install the LTS version of Node
- task: UseNode@1
name: use_node
displayName: Install Node
inputs:
version: 22.X
- task: Cache@2
enabled: false
inputs:
key: 'pnpm | "$(Agent.OS)" | pnpm-lock.yaml'
path: $(pnpm_config_cache)
displayName: Cache pnpm
- script: |
corepack enable
displayName: "Setup pnpm"
# - script: |
# corepack enable
# corepack prepare pnpm@latest-9 --activate
# pnpm config set store-dir $(pnpm_config_cache)
# displayName: "Setup pnpm"
- script: |
pnpm install
name: install
displayName: "pnpm install --frozen-lockfile --reporter append-only"
- script: |
pnpm test
name: pnpm_test
displayName: "pnpm test"
- script: |
pnpm run build
name: build
displayName: "pnpm build"
# Count the number of files in the 'dist' folder
# to make sure there are actually files there.
# This script will return a non-zero exit code
# if there are no files.
- script: |
node tools/count-files.js
name: count_files
displayName: "Count files"
- task: PublishTestResults@2
name: publish_test_results
displayName: Publish Test Results
condition: succeededOrFailed()
continueOnError: true
inputs:
searchFolder: ./test-results
testResultsFiles: test-results.xml
# This task is disabled for the moment because enabling coverage causes
# the unit test to run forever after mocking was added.
# The issue is that mocking is not implemented for all URLs, so once that
# has been completed then this task can be enabled again.
- task: PublishCodeCoverageResults@2
enabled: false
name: publish_code_coverage
displayName: Publish Code Coverage
continueOnError: true
inputs:
summaryFileLocation: coverage/cobertura-coverage.xml
# Copy the build output (dist folder) to the staging directory for artifact publishing.
- task: CopyFiles@2
name: copy_files
displayName: Copy Files to $(Build.ArtifactStagingDirectory)
inputs:
# The target folder to copy files to, typically a staging directory for artifacts.
TargetFolder: $(Build.ArtifactStagingDirectory)
# The contents to copy, in this case, everything from the 'dist' folder.
Contents: dist/**
# Publish the build artifacts to Azure Pipelines.
- task: PublishBuildArtifacts@1
name: publish_build_artifacts
displayName: Publish Build Artifacts
inputs:
# The path to the folder containing build artifacts to publish.
PathtoPublish: $(Build.ArtifactStagingDirectory)
# The name for this artifact, which can be used for deployment or reference.
ArtifactName: www