Skip to content

Commit 7426bcc

Browse files
committed
fix pipeline
1 parent 366154f commit 7426bcc

File tree

2 files changed

+112
-121
lines changed

2 files changed

+112
-121
lines changed

pipelines/azure-build-ts.yml

+74-83
Original file line numberDiff line numberDiff line change
@@ -20,89 +20,80 @@ pr:
2020
- "*"
2121

2222
pool:
23-
vmImage: 'ubuntu-latest'
23+
vmImage: "ubuntu-latest"
2424

2525
variables:
26-
node_version: '18'
27-
pnpm_version: '9.0.0'
28-
workingDirectory: 'ts'
29-
agentsdk_folder: 'ts/packages/agentSdk'
30-
26+
workingDirectory: "ts"
27+
agentsdk_folder: "ts/packages/agentSdk"
28+
3129
jobs:
32-
- job: build_ts
33-
displayName: 'Build TypeScript Project'
34-
strategy:
35-
matrix:
36-
node_20:
37-
nodeVersion: '20'
38-
steps:
39-
- checkout: TypeAgent-GH
40-
displayName: 'Checkout TypeAgent Repository'
41-
path: 'typeagent'
42-
43-
- template: include-install-pnpm.yml
44-
parameters:
45-
buildDirectory: $(Build.SourcesDirectory)/ts
46-
47-
- script: |
48-
curl -fsSL https://get.pnpm.io/v6.14.js | node - add --global pnpm@$(pnpm_version)
49-
export PNPM_HOME="$HOME/.local/share/pnpm"
50-
export PATH="$PNPM_HOME:$PATH"
51-
displayName: 'Install pnpm'
52-
condition: always()
53-
54-
- task: UseNode@1
55-
displayName: 'Setup Node.js'
56-
inputs:
57-
version: $(nodeVersion)
58-
checkLatest: true
59-
60-
- script: |
61-
pnpm install --frozen-lockfile --strict-peer-dependencies
62-
displayName: 'Install dependencies'
63-
workingDirectory: $(workingDirectory)
64-
65-
- script: |
66-
current_version=$(node -p "require('./package.json').version")
67-
new_version="${current_version}-$(Build.BuildId)"
68-
echo "##vso[task.setvariable variable=package_version]$new_version"
69-
jq ".version=\"$new_version\"" package.json > package.tmp.json
70-
mv package.tmp.json package.json
71-
echo "Updated package.json to version $new_version"
72-
cat package.json
73-
displayName: 'Update Package Version'
74-
workingDirectory: $(agentsdk_folder)
75-
76-
- script: |
77-
npm run build
78-
displayName: 'Build'
79-
workingDirectory: $(workingDirectory)
80-
81-
- script: |
82-
npm run test
83-
displayName: 'Run Tests'
84-
workingDirectory: $(workingDirectory)
85-
86-
- script: |
87-
npm run lint
88-
displayName: 'Lint'
89-
workingDirectory: $(workingDirectory)
90-
91-
- script: |
92-
echo $(ADO_REGISTRY)
93-
echo "registry=$(ADO_REGISTRY)" > .npmrc
94-
echo "always-auth=true" >> .npmrc
95-
cat .npmrc
96-
displayName: 'Create .npmrc file.'
97-
workingDirectory: $(agentsdk_folder)
98-
99-
- task: npmAuthenticate@0
100-
inputs:
101-
workingFile: '$(agentsdk_folder)/.npmrc'
102-
displayName: 'Authenticate with Azure Artifacts'
103-
104-
- script: |
105-
cd $(Build.SourcesDirectory)/$(agentsdk_folder)
106-
npm publish --registry=$(ADO_REGISTRY)
107-
displayName: 'Pack and Publish agent-sdk Module'
108-
condition: succeeded()
30+
- job: build_ts
31+
displayName: "Build TypeScript Project"
32+
strategy:
33+
matrix:
34+
node_20:
35+
nodeVersion: "22"
36+
steps:
37+
- checkout: TypeAgent-GH
38+
displayName: "Checkout TypeAgent Repository"
39+
path: "typeagent"
40+
41+
- template: include-install-pnpm.yml
42+
parameters:
43+
buildDirectory: $(Build.SourcesDirectory)/ts
44+
45+
- task: UseNode@1
46+
displayName: "Setup Node.js"
47+
inputs:
48+
version: $(nodeVersion)
49+
checkLatest: true
50+
51+
- script: |
52+
pnpm install --frozen-lockfile --strict-peer-dependencies
53+
displayName: "Install dependencies"
54+
workingDirectory: $(workingDirectory)
55+
56+
- script: |
57+
current_version=$(node -p "require('./package.json').version")
58+
new_version="${current_version}-$(Build.BuildId)"
59+
echo "##vso[task.setvariable variable=package_version]$new_version"
60+
jq ".version=\"$new_version\"" package.json > package.tmp.json
61+
mv package.tmp.json package.json
62+
echo "Updated package.json to version $new_version"
63+
cat package.json
64+
displayName: "Update Package Version"
65+
workingDirectory: $(agentsdk_folder)
66+
67+
- script: |
68+
npm run build
69+
displayName: "Build"
70+
workingDirectory: $(workingDirectory)
71+
72+
- script: |
73+
npm run test
74+
displayName: "Run Tests"
75+
workingDirectory: $(workingDirectory)
76+
77+
- script: |
78+
npm run lint
79+
displayName: "Lint"
80+
workingDirectory: $(workingDirectory)
81+
82+
- script: |
83+
echo $(ADO_REGISTRY)
84+
echo "registry=$(ADO_REGISTRY)" > .npmrc
85+
echo "always-auth=true" >> .npmrc
86+
cat .npmrc
87+
displayName: "Create .npmrc file."
88+
workingDirectory: $(agentsdk_folder)
89+
90+
- task: npmAuthenticate@0
91+
inputs:
92+
workingFile: "$(agentsdk_folder)/.npmrc"
93+
displayName: "Authenticate with Azure Artifacts"
94+
95+
- script: |
96+
cd $(Build.SourcesDirectory)/$(agentsdk_folder)
97+
npm publish --registry=$(ADO_REGISTRY)
98+
displayName: "Pack and Publish agent-sdk Module"
99+
condition: succeeded()

pipelines/include-install-pnpm.yml

+38-38
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,46 @@
66
# This template can be included in pipelines to install pnpm with store caching enabled.
77

88
parameters:
9-
# The path containing the project(s) to build.
10-
- name: buildDirectory
11-
type: string
9+
# The path containing the project(s) to build.
10+
- name: buildDirectory
11+
type: string
1212

13-
# If set to false, the pnpm store will not be cached or restored from cache.
14-
- name: enableCache
15-
type: boolean
16-
default: true
13+
# If set to false, the pnpm store will not be cached or restored from cache.
14+
- name: enableCache
15+
type: boolean
16+
default: true
1717

18-
# The path to the pnpm store. The contents here will be cached and restored when using pnpm in a pipeline.
19-
- name: pnpmStorePath
20-
type: string
21-
default: $(Pipeline.Workspace)/.pnpm-store
18+
# The path to the pnpm store. The contents here will be cached and restored when using pnpm in a pipeline.
19+
- name: pnpmStorePath
20+
type: string
21+
default: $(Pipeline.Workspace)/.pnpm-store
2222

2323
steps:
24-
- ${{ if eq(parameters.enableCache, true) }}:
25-
- task: Cache@2
26-
displayName: Cache pnpm store
27-
timeoutInMinutes: 3
28-
continueOnError: true
29-
inputs:
30-
# Caches are already scoped to individual pipelines, so no need to include the release group name or tag
31-
# in the cache key
32-
key: 'pnpm-store | "$(Agent.OS)" | ${{ parameters.buildDirectory }}/pnpm-lock.yaml'
33-
path: ${{ parameters.pnpmStorePath }}
34-
restoreKeys: |
35-
pnpm-store | "$(Agent.OS)"
24+
- ${{ if eq(parameters.enableCache, true) }}:
25+
- task: Cache@2
26+
displayName: Cache pnpm store
27+
timeoutInMinutes: 3
28+
continueOnError: true
29+
inputs:
30+
# Caches are already scoped to individual pipelines, so no need to include the release group name or tag
31+
# in the cache key
32+
key: 'pnpm-store | "$(Agent.OS)" | ${{ parameters.buildDirectory }}/pnpm-lock.yaml'
33+
path: ${{ parameters.pnpmStorePath }}
34+
restoreKeys: |
35+
pnpm-store | "$(Agent.OS)"
3636
37-
- task: Bash@3
38-
displayName: Install and configure pnpm
39-
inputs:
40-
targetType: 'inline'
41-
workingDirectory: ${{ parameters.buildDirectory }}
42-
# The previous task (cache restoration) can timeout, which is classified as canceled, but since it's just cache
43-
# restoration, we want to continue even if it timed out.
44-
condition: or(succeeded(), canceled())
45-
# workspace-concurrency 0 means use use the CPU core count. This is better than the default (4) for larger agents.
46-
script: |
47-
echo "Using node $(node --version)"
48-
sudo corepack enable
49-
echo "Using pnpm $(pnpm -v)"
50-
pnpm config set store-dir ${{ parameters.pnpmStorePath }}
51-
pnpm config set -g workspace-concurrency 0
37+
- task: Bash@3
38+
displayName: Install and configure pnpm
39+
inputs:
40+
targetType: "inline"
41+
workingDirectory: ${{ parameters.buildDirectory }}
42+
# The previous task (cache restoration) can timeout, which is classified as canceled, but since it's just cache
43+
# restoration, we want to continue even if it timed out.
44+
condition: or(succeeded(), canceled())
45+
# workspace-concurrency 0 means use use the CPU core count. This is better than the default (4) for larger agents.
46+
script: |
47+
echo "Using node $(node --version)"
48+
sudo corepack enable
49+
echo "Using pnpm $(pnpm -v)"
50+
pnpm config set store-dir ${{ parameters.pnpmStorePath }}
51+
pnpm config set -g workspace-concurrency 0

0 commit comments

Comments
 (0)