Skip to content

Commit d635633

Browse files
mayur007bali-hamud
authored andcommitted
Merged PR 84213: Create JEDI CDPx pipeline for powerbi-javascript
Old abandoned PR: https://dev.azure.com/powerbi/Embedded/_git/powerbi-javascript/pullrequest/83384 Related work items: #353647
1 parent ee01207 commit d635633

9 files changed

+176
-2
lines changed

.pipelines/build.ps1

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$exitCode = 0;
2+
3+
Write-Host "start: npm run build"
4+
& npm run build
5+
Write-Host "done: npm run build"
6+
7+
$exitCode += $LASTEXITCODE;
8+
9+
Write-Host "start: Get dist folder files"
10+
& dir "dist"
11+
Write-Host "Done: Get dist folder files"
12+
13+
exit $exitCode

.pipelines/cdpx_run_ps.cmd

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
setlocal enabledelayedexpansion
2+
pushd "%~dp0\.."
3+
powershell.exe -ExecutionPolicy Unrestricted -NoProfile -WindowStyle Hidden -NonInteractive -File "%~dp0%~1"
4+
endlocal
5+
popd
6+
exit /B %ERRORLEVEL%

.pipelines/nuget_pack.ps1

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Write-Host "Start running nuget_pack.ps1"
2+
3+
$versionNumber = [Environment]::GetEnvironmentVariable("CustomBuildNumber", "User");
4+
$exitCode = 0;
5+
6+
Write-Host "Nuget Pack ..\PowerBI.JavaScript.nuspec -Version "$versionNumber
7+
& nuget pack "..\PowerBI.JavaScript.nuspec" -Version $versionNumber
8+
9+
$exitCode += $LASTEXITCODE;
10+
11+
exit $exitCode

.pipelines/package.ps1

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$exitCode = 0;
2+
3+
Write-Host "start: npm pack"
4+
& npm pack
5+
Write-Host "done: npm pack"
6+
7+
$exitCode += $LASTEXITCODE;
8+
9+
Write-Host "start: Get content of current folder"
10+
& dir
11+
Write-Host "done: Get content of current folder"
12+
13+
exit $exitCode

.pipelines/pipeline.user.windows.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
environment:
2+
host:
3+
os: 'windows'
4+
flavor: 'server'
5+
version: '2016'
6+
runtime:
7+
provider: 'appcontainer'
8+
image: 'cdpxwinrs5.azurecr.io/global/vse2019/16.3.7:latest'
9+
source_mode: 'map'
10+
11+
artifact_publish_options:
12+
publish_to_legacy_artifacts: false
13+
publish_to_pipeline_artifacts: true
14+
publish_to_cloudvault_artifacts: false
15+
16+
package_sources:
17+
npm:
18+
feeds:
19+
registry: https://powerbi.pkgs.visualstudio.com/_packaging/SDK.Externals/npm/registry/
20+
21+
version:
22+
major: 1 # <---- Required field but not being used for 'custom' scheme
23+
minor: 0 # <---- Required field but not being used for 'custom' scheme
24+
system: 'custom' # <---- Set this to 'custom'. we will build the version using package.json in versioning commands.
25+
26+
versioning:
27+
commands:
28+
- !!defaultcommand
29+
name: 'Set Version'
30+
arguments: 'version.ps1'
31+
command: '.pipelines\cdpx_run_ps.cmd'
32+
33+
restore:
34+
commands:
35+
- !!defaultcommand
36+
name: 'NPM Install'
37+
arguments: 'restore.ps1'
38+
command: '.pipelines\cdpx_run_ps.cmd'
39+
40+
build:
41+
commands:
42+
- !!buildcommand
43+
name: 'Build'
44+
arguments: 'build.ps1'
45+
command: '.pipelines\cdpx_run_ps.cmd'
46+
artifacts:
47+
- from: 'dist'
48+
to: 'build_artifacts'
49+
include:
50+
- '**/*'
51+
exclude:
52+
- '**/node_modules/**/*.*'
53+
54+
- !!buildcommand
55+
name: 'Package'
56+
arguments: 'package.ps1'
57+
command: '.pipelines\cdpx_run_ps.cmd'
58+
artifacts:
59+
- include:
60+
- "**/*.tgz"
61+
62+
- !!buildcommand
63+
name: 'Nuget Pack'
64+
arguments: 'nuget_pack.ps1'
65+
command: '.pipelines\cdpx_run_ps.cmd'
66+
artifacts:
67+
- to: 'Release'
68+
include:
69+
- "**/*.nupkg"
70+
71+
test:
72+
commands:
73+
- !!testcommand
74+
name: 'Test powerbi-javascript'
75+
arguments: 'test.ps1'
76+
command: '.pipelines\cdpx_run_ps.cmd'
77+
testresults:
78+
- title: 'powerbi-javascript test results'
79+
type: 'jasmine'
80+
from: 'reports'
81+
include:
82+
- "**coverage/**/index.html"

.pipelines/restore.ps1

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Write-Host "Start build ..."
2+
Write-Host "Global node/npm paths ..."
3+
& where.exe npm
4+
& where.exe node
5+
6+
Write-Host "Global node version"
7+
& node -v
8+
9+
Write-Host "Global npm version"
10+
& npm -v
11+
12+
$exitCode = 0;
13+
14+
Write-Host "start: try install latest npm version"
15+
& npm install npm@latest -g
16+
Write-Host "done: try install latest npm version"
17+
18+
# Do not update $exitCode because we do not want to fail if install latest npm version fails.
19+
20+
Write-Host "start: npm install"
21+
& npm install --no-audit --no-save
22+
Write-Host "done: npm install"
23+
24+
$exitCode += $LASTEXITCODE;
25+
26+
exit $exitCode

.pipelines/test.ps1

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
$exitCode = 0;
2+
3+
Write-Host "start: npm run test"
4+
& npm run test
5+
Write-Host "done: npm run test"
6+
7+
$exitCode += $LASTEXITCODE;
8+
9+
exit $exitCode;

.pipelines/version.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
try {
2+
# package.json is in root folder, while version.ps1 runs in .pipelines folder.
3+
$version = (Get-Content "package.json") -join "`n" | ConvertFrom-Json | Select -ExpandProperty "version"
4+
$revision = $env:CDP_DEFINITION_BUILD_COUNT_DAY
5+
$buildNumber = "$version.$revision"
6+
7+
Write-Host "Build Number is" $buildNumber
8+
9+
[Environment]::SetEnvironmentVariable("CustomBuildNumber", $buildNumber, "User") # This will allow you to use it from env var in later steps of the same phase
10+
Write-Host "##vso[build.updatebuildnumber]${buildNumber}" # This will update build number on your build
11+
}
12+
catch {
13+
Write-Error $_.Exception
14+
exit 1;
15+
}

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"scripts": {
1414
"build": "gulp build",
1515
"start": "http-server ./demo",
16-
"gulpversion": "gulp build && git add .",
17-
"prepublish": "typings install && gulp build",
16+
"postinstall": "typings install",
1817
"prestart": "cd demo && npm install",
1918
"test": "gulp test",
2019
"gulp": "gulp",

0 commit comments

Comments
 (0)