Skip to content

Commit 5f410a6

Browse files
authored
[JS] Create a JS pipeline (#6833)
* redo pipeline * update testapp * Revert "update testapp" This reverts commit 1018f96. * update pipeline * small change * npm i -g npm@latest on Windows image * npm i --force * build and run test in /tests/ folder * Update js-ci.yml for Azure Pipelines * disabe ui test
1 parent 5f05d08 commit 5f410a6

File tree

2 files changed

+101
-1
lines changed

2 files changed

+101
-1
lines changed

.pipelines/js-ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: $(date:yyMM).$(date:dd)$(rev:rrr)
2+
3+
pr:
4+
branches:
5+
include:
6+
- main
7+
paths:
8+
include:
9+
- source/nodejs
10+
11+
pool:
12+
name: Azure Pipelines
13+
vmImage: windows-2019
14+
demands:
15+
- npm
16+
17+
parameters:
18+
- name: target_packages
19+
displayName: "Which packages is going to be built."
20+
type: object
21+
default:
22+
- adaptivecards
23+
- adaptivecards-controls
24+
- adaptivecards-designer
25+
- adaptivecards-templating
26+
- adaptivecards-react
27+
28+
- name: test_apps
29+
displayName: "Which project is going to be consume the built npm packages."
30+
type: object
31+
default:
32+
- adaptivecards-ui-testapp
33+
- adaptivecards-react-testapp
34+
35+
- name: test_projects
36+
displayName: "project in tests/."
37+
type: object
38+
default:
39+
# - test-adaptive-card-schema # bug https://github.com/microsoft/AdaptiveCards/issues/6882
40+
# - ui-tests # bug https://github.com/microsoft/AdaptiveCards/issues/6885
41+
- unit-tests
42+
43+
steps:
44+
- task: NodeTool@0
45+
name: NodeTool1
46+
displayName: Use Node 14.x
47+
inputs:
48+
versionSpec: 14.x
49+
50+
- bash: |
51+
npm i -g npm@latest
52+
npm ci
53+
npx lerna bootstrap --ci
54+
npx lerna run release
55+
workingDirectory: source/nodejs
56+
displayName: 'Bash - lerna bootstrap'
57+
58+
- bash: |
59+
npx lerna run test
60+
workingDirectory: source/nodejs
61+
displayName: 'Run all tests'
62+
condition: failed() # This is disabled because of issue 6874
63+
64+
- ${{ each target_package in parameters.target_packages }}:
65+
- task: Npm@1
66+
displayName: '[${{ target_package }}] npm pack'
67+
inputs:
68+
command: custom
69+
customCommand: pack
70+
workingDir: source/nodejs/${{ target_package }}
71+
72+
- task: CopyFiles@2
73+
inputs:
74+
sourceFolder: source/nodejs/${{ target_package }}
75+
contents: '${{ target_package }}*.tgz'
76+
targetFolder: ../
77+
displayName: 'Copy tgz to ../'
78+
79+
- ${{ each test_project in parameters.test_projects }}:
80+
- bash: |
81+
npm i
82+
npm run build-and-test
83+
workingDirectory: source/nodejs/tests/${{ test_project }}
84+
displayName: 'Build and run test in tests/[${{ test_project }}]'
85+
86+
- bash: |
87+
git clean -dxf
88+
npm i
89+
workingDirectory: source/nodejs
90+
displayName: 'clean and re-install the package'
91+
92+
- ${{ each test_app in parameters.test_apps }}:
93+
- bash: |
94+
npm i ../../../../*.tgz --force
95+
cat package.json
96+
npm i
97+
npm run build
98+
workingDirectory: source/nodejs/${{ test_app }}
99+
displayName: 'Install the built package and build the [${{ test_app }}]'

source/nodejs/tests/ui-tests/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"clean": "rimraf lib dist",
1313
"build": "tsc",
1414
"lint": "eslint src/*.ts",
15-
"test": "npm run build && jest ./lib/*"
15+
"test": "jest ./lib/*",
16+
"build-and-test": "npm run build && npm run test"
1617
},
1718
"devDependencies": {
1819
"selenium-webdriver": "^4.1.0",

0 commit comments

Comments
 (0)