Skip to content

Commit 8d249f9

Browse files
Hristo HristovHristo Hristov
authored andcommitted
feat: add azure pipelines yaml files for angular, react and wc templates
1 parent e2e8a6f commit 8d249f9

File tree

7 files changed

+177
-12
lines changed

7 files changed

+177
-12
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Azure CI
2+
3+
trigger:
4+
branches:
5+
include: [ $(yamlDefaultBranch) ]
6+
7+
pr:
8+
branches:
9+
include: [ $(yamlDefaultBranch) ]
10+
11+
pool:
12+
vmImage: 'ubuntu-latest'
13+
14+
steps:
15+
- script: npm i # replace with 'npm ci' after committing lock file from first install
16+
displayName: 'Install dependencies'
17+
- script: npm run lint
18+
displayName: 'Run linter'
19+
continueOnError: true
20+
- script: npm run build
21+
displayName: 'Build the project'
22+
- script: npm run test
23+
displayName: 'Run tests'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Azure CI
2+
3+
trigger:
4+
branches:
5+
include: [ $(yamlDefaultBranch) ]
6+
7+
pr:
8+
branches:
9+
include: [ $(yamlDefaultBranch) ]
10+
11+
pool:
12+
vmImage: 'ubuntu-latest'
13+
14+
steps:
15+
- script: npm i # replace with 'npm ci' after committing lock file from first install
16+
displayName: 'Install dependencies'
17+
- script: npm run lint
18+
displayName: 'Run linter'
19+
continueOnError: true
20+
- script: npm run build
21+
displayName: 'Build the project'
22+
- script: npm run test
23+
displayName: 'Run tests'

packages/core/update/Update.ts

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ export async function updateWorkspace(rootPath: string): Promise<boolean> {
122122
}
123123
updatePackageJsonFiles(pkgJsonFiles, upgradeable, fs);
124124
createNpmrc(rootPath, fs);
125-
updateWorkflows(fs);
125+
updateGithubWorkflows(fs);
126+
updateAzureWorkflows(fs);
126127

127128
return true;
128129
}
@@ -213,28 +214,54 @@ function updatePackageJsonFiles(
213214
}
214215

215216
function updateWorkflows(
216-
fs: IFileSystem
217+
fs: IFileSystem,
218+
basePath: string,
219+
workflowFiles: string[],
220+
oldInstallCmd: string,
221+
newInstallCmd: string
217222
): void {
218-
const workflowFiles = ["node.js.yml", "github-pages.yml"];
219-
const oldNpmInstall = "- run: npm i # replace with 'npm ci' after committing lock file from first install";
220-
const newNpmInstall =
221-
`- run: echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> ~/.npmrc
222-
- run: echo "//packages.infragistics.com/npm/js-licensed/:_auth=\${{ secrets.NPM_AUTH_TOKEN }}" >> ~/.npmrc
223-
- run: echo "//packages.infragistics.com/npm/js-licensed/:always-auth=true" >> ~/.npmrc
224-
- run: npm i # replace with 'npm ci' after committing lock file from first install`;
225-
226223
for (const fileName of workflowFiles) {
227-
const workflowPath = `.github/workflows/${fileName}`;
224+
const workflowPath = `${basePath}/${fileName}`;
228225
if (fs.fileExists(workflowPath)) {
229226
let workflow = fs.readFile(workflowPath);
230227
if (workflow) {
231-
workflow = workflow.replace(oldNpmInstall, newNpmInstall);
228+
workflow = workflow.replace(oldInstallCmd, newInstallCmd);
232229
fs.writeFile(workflowPath, workflow);
233230
}
234231
}
235232
}
236233
}
237234

235+
function updateGithubWorkflows(fs: IFileSystem): void {
236+
updateWorkflows(
237+
fs,
238+
".github/workflows",
239+
["node.js.yml", "github-pages.yml"],
240+
"- run: npm i # replace with 'npm ci' after committing lock file from first install",
241+
`- run: echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> ~/.npmrc
242+
- run: echo "//packages.infragistics.com/npm/js-licensed/:_auth=\${{ secrets.NPM_AUTH_TOKEN }}" >> ~/.npmrc
243+
- run: echo "//packages.infragistics.com/npm/js-licensed/:always-auth=true" >> ~/.npmrc
244+
- run: npm i # replace with 'npm ci' after committing lock file from first install`
245+
);
246+
}
247+
248+
function updateAzureWorkflows(fs: IFileSystem): void {
249+
updateWorkflows(
250+
fs,
251+
".azure/workflows",
252+
["azure-pipelines.yml"],
253+
"- script: npm i # replace with 'npm ci' after committing lock file from first install",
254+
`- script: |
255+
echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> ~/.npmrc
256+
echo "//packages.infragistics.com/npm/js-licensed/:_auth=$NPM_AUTH_TOKEN" >> ~/.npmrc
257+
echo "//packages.infragistics.com/npm/js-licensed/:always-auth=true" >> ~/.npmrc
258+
displayName: 'Authenticate'
259+
env:
260+
NPM_AUTH_TOKEN: $(NPM_AUTH_TOKEN)
261+
- script: npm i # replace with 'npm ci' after committing lock file from first install`
262+
);
263+
}
264+
238265
function createNpmrc(
239266
rootPath: string,
240267
fs: IFileSystem
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Azure CI
2+
3+
trigger:
4+
branches:
5+
include: [ <%=yamlDefaultBranch%> ]
6+
7+
pr:
8+
branches:
9+
include: [ <%=yamlDefaultBranch%> ]
10+
11+
pool:
12+
vmImage: 'ubuntu-latest'
13+
14+
steps:
15+
- script: npm i # replace with 'npm ci' after committing lock file from first install
16+
displayName: 'Install dependencies'
17+
- script: npm run lint
18+
displayName: 'Run linter'
19+
continueOnError: true
20+
- script: npm run build
21+
displayName: 'Build the project'
22+
- script: npm run test -- --watch=false --browsers ChromeHeadless
23+
displayName: 'Run tests'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Azure CI
2+
3+
trigger:
4+
branches:
5+
include: [ <%=yamlDefaultBranch%> ]
6+
7+
pr:
8+
branches:
9+
include: [ <%=yamlDefaultBranch%> ]
10+
11+
pool:
12+
vmImage: 'ubuntu-latest'
13+
14+
steps:
15+
- script: npm i # replace with 'npm ci' after committing lock file from first install
16+
displayName: 'Install dependencies'
17+
- script: npm run lint
18+
displayName: 'Run linter'
19+
continueOnError: true
20+
- script: npm run build
21+
displayName: 'Build the project'
22+
- script: npm run test -- --watch=false --browsers ChromeHeadless
23+
displayName: 'Run tests'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Azure CI
2+
3+
trigger:
4+
branches:
5+
include: [ <%=yamlDefaultBranch%> ]
6+
7+
pr:
8+
branches:
9+
include: [ <%=yamlDefaultBranch%> ]
10+
11+
pool:
12+
vmImage: 'ubuntu-latest'
13+
14+
steps:
15+
- script: npm i # replace with 'npm ci' after committing lock file from first install
16+
displayName: 'Install dependencies'
17+
- script: npm run lint
18+
displayName: 'Run linter'
19+
continueOnError: true
20+
- script: npm run build
21+
displayName: 'Build the project'
22+
- script: npm run test -- --watch=false --browsers ChromeHeadless
23+
displayName: 'Run tests'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Azure CI
2+
3+
trigger:
4+
branches:
5+
include: [ <%=yamlDefaultBranch%> ]
6+
7+
pr:
8+
branches:
9+
include: [ <%=yamlDefaultBranch%> ]
10+
11+
pool:
12+
vmImage: 'ubuntu-latest'
13+
14+
steps:
15+
- script: npm i # replace with 'npm ci' after committing lock file from first install
16+
displayName: 'Install dependencies'
17+
- script: npm run lint
18+
displayName: 'Run linter'
19+
continueOnError: true
20+
- script: npm run build
21+
displayName: 'Build the project'
22+
- script: npm run test -- --watch=false --browsers ChromeHeadless
23+
displayName: 'Run tests'

0 commit comments

Comments
 (0)