Skip to content

Commit

Permalink
Pipelines and setup for cosmos sdk (#16)
Browse files Browse the repository at this point in the history
* resolve merge conflict - tsconfig.json

* add cosmos in rush.json

* update dependencies - sync-versions

* add script "extract-api"

* delete .prettierrc

* update package.json script commands

* npm run bundle command

* Fix typo in samples/package.json

* npm run clean command

* remove unrelated file .gitattributes

* Update package.json repo links

* add ci.yml from cosmos v2

* Node 6 to Node 8 - integration step

* azure-cosmos-js -> azure-sdk-for-js

* Update License document

* update tool chain from npm to rush

* add package name

* delete package-lock.json

* add cosmos-additional-steps.yml file

* add PostIntegrationSteps variable

* condition: succeededOrFailed() for additional steps

* add parameters PackageName and PackagePath

* Smaller Matrix for Unit tests as per Daniel's idea

* parameters - fix typo

* regenerate pnpm-lock file

* test:consumer -> test-consumer

* remove matrix for unit-tests
  • Loading branch information
HarshaNalluru authored Aug 23, 2019
1 parent 68e9d57 commit 066aad7
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 45 deletions.
28 changes: 14 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,20 @@ If you want to get back to a completely clean state, you can instead run `rush r

Generally speaking, the following commands are roughly equivalent:

| NPM command | Rush command | Rush command effect |
| ------------------------------------ | ------------------------------------ | ---------------------------------------------------------------- |
| `npm install` | `rush update` | Install dependencies for all projects in the Rush workspace |
| `npm install --save[-dev] <package>` | `rush add -p <package> --caret [--dev]` | Add or update a dependency in the current project |
| `npm build` | `rush [re]build` | Build all projects in the Rush workspace |
| | `rush [re]build -t <package>` | Build named project and any projects it depends on |
| | `rushx build` | Build the current project only |
| `npm test` | `rush test` | Run dev tests in all projects in the Rush workspace |
| | `rush test -t <packagename>` | Run dev tests in named project and any projects it depends on |
| | `rushx test` | Run dev tests in the current project only |
| `npm run <scriptname>` | `rush <scriptname>` | Run named script in all projects in the Rush workspace |
| | `rush <scriptname> -t <packagename>` | Run named script in named project and any projects it depends on |
| | `rushx <scriptname>` | Run named script in the current project only |
| `npx <command>` | `node_modules/.bin/<command>` | Run named command provided by installed dependency package |
| NPM command | Rush command | Rush command effect |
| ------------------------------------ | --------------------------------------- | ---------------------------------------------------------------- |
| `npm install` | `rush update` | Install dependencies for all projects in the Rush workspace |
| `npm install --save[-dev] <package>` | `rush add -p <package> --caret [--dev]` | Add or update a dependency in the current project |
| `npm build` | `rush [re]build` | Build all projects in the Rush workspace |
| | `rush [re]build -t <package>` | Build named project and any projects it depends on |
| | `rushx build` | Build the current project only |
| `npm test` | `rush test` | Run dev tests in all projects in the Rush workspace |
| | `rush test -t <packagename>` | Run dev tests in named project and any projects it depends on |
| | `rushx test` | Run dev tests in the current project only |
| `npm run <scriptname>` | `rush <scriptname>` | Run named script in all projects in the Rush workspace |
| | `rush <scriptname> -t <packagename>` | Run named script in named project and any projects it depends on |
| | `rushx <scriptname>` | Run named script in the current project only |
| `npx <command>` | `node_modules/.bin/<command>` | Run named command provided by installed dependency package |

## Onboarding a new library

Expand Down
13 changes: 13 additions & 0 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
"ignoreMissingScript": false,
"allowWarningsInSuccessfulBuild": true
},
{
"commandKind": "bulk",
"name": "build:samples",
"summary": "Build the samples only in projects",
"enableParallelism": true,
"allowWarningsInSuccessfulBuild": true
},
{
"commandKind": "bulk",
"name": "build:test",
Expand Down Expand Up @@ -100,6 +107,12 @@
"summary": "Execute browser dev tests defined in projects",
"enableParallelism": true
},
{
"commandKind": "bulk",
"name": "test-consumer",
"summary": "Execute consumer tests defined in projects",
"enableParallelism": true
},
{
"commandKind": "bulk",
"name": "test:node",
Expand Down
59 changes: 31 additions & 28 deletions eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
parameters:
Matrix:
Linux_Node8:
OSVmImage: "ubuntu-16.04"
NodeVersion: "8.x"
Linux_Node10:
OSVmImage: "ubuntu-16.04"
NodeVersion: "10.x"
Linux_Node12:
OSVmImage: "ubuntu-16.04"
NodeVersion: "12.x"
macOS_Node8:
OSVmImage: "macOS-10.13"
NodeVersion: "8.x"
macOS_Node10:
OSVmImage: "macOS-10.13"
NodeVersion: "10.x"
macOS_Node12:
OSVmImage: "macOS-10.13"
NodeVersion: "12.x"
Windows_Node8:
OSVmImage: "vs2017-win2016"
NodeVersion: "8.x"
Windows_Node10:
OSVmImage: "vs2017-win2016"
NodeVersion: "10.x"
Windows_Node12:
OSVmImage: "vs2017-win2016"
NodeVersion: "12.x"

jobs:
- job: "Build"
variables:
Expand Down Expand Up @@ -119,34 +149,7 @@ jobs:
- job: "UnitTest"

strategy:
matrix:
Linux_Node8:
OSVmImage: "ubuntu-16.04"
NodeVersion: "8.x"
Linux_Node10:
OSVmImage: "ubuntu-16.04"
NodeVersion: "10.x"
Linux_Node12:
OSVmImage: "ubuntu-16.04"
NodeVersion: "12.x"
macOS_Node8:
OSVmImage: "macOS-10.13"
NodeVersion: "8.x"
macOS_Node10:
OSVmImage: "macOS-10.13"
NodeVersion: "10.x"
macOS_Node12:
OSVmImage: "macOS-10.13"
NodeVersion: "12.x"
Windows_Node8:
OSVmImage: "vs2017-win2016"
NodeVersion: "8.x"
Windows_Node10:
OSVmImage: "vs2017-win2016"
NodeVersion: "10.x"
Windows_Node12:
OSVmImage: "vs2017-win2016"
NodeVersion: "12.x"
matrix: ${{parameters.Matrix}}

pool:
vmImage: "$(OSVmImage)"
Expand Down
2 changes: 2 additions & 0 deletions eng/pipelines/templates/jobs/archetype-sdk-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ parameters:
PackageName: "" # For Rush toolchain only
PackagePath: "" # For NPM toolchain only
PreIntegrationSteps: ""
PostIntegrationSteps: ""
EnvVars: []
MaxParallel: 0
Matrix:
Expand Down Expand Up @@ -58,6 +59,7 @@ jobs:
PackageName: ${{parameters.PackageName}}
PackagePath: ${{parameters.PackagePath}}
PreIntegrationSteps: ${{parameters.PreIntegrationSteps}}
PostIntegrationSteps: ${{parameters.PostIntegrationSteps}}
TestType: $(TestType)
EnvVars: ${{parameters.EnvVars}}

Expand Down
20 changes: 20 additions & 0 deletions eng/pipelines/templates/steps/cosmos-additional-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
parameters:
PackagePath: "sdk/cosmosdb/cosmos/"
PackageName: "@azure/cosmos"

steps:
- script: |
node common/scripts/install-run-rush.js test-consumer -t "${{parameters.PackageName}}" --verbose
condition: succeededOrFailed()
displayName: "TypeScript Consumer Tests - Cosmos"
- script: |
node common/scripts/install-run-rush.js build:samples -t "${{parameters.PackageName}}" --verbose
condition: succeededOrFailed()
displayName: "Typecheck Samples - Cosmos"
- script: |
npm run execute:samples
condition: succeededOrFailed()
displayName: "Run Samples - Cosmos"
workingDirectory: "${{parameters.PackagePath}}"
5 changes: 4 additions & 1 deletion eng/pipelines/templates/steps/integration-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ steps:
workingDirectory: "${{parameters.PackagePath}}"
- ${{if ne(parameters.PreIntegrationSteps, '')}}:
- template: ../steps/${{parameters.PreIntegrationSteps}}.yml
- template: ../steps/${{parameters.PreIntegrationSteps}}.yml

- script: |
npm run integration-test:${{parameters.TestType}}
displayName: "Integration test libraries"
workingDirectory: "${{parameters.PackagePath}}"
env: ${{parameters.EnvVars}}
- ${{if ne(parameters.PostIntegrationSteps, '')}}:
- template: ../steps/${{parameters.PostIntegrationSteps}}.yml
5 changes: 4 additions & 1 deletion eng/pipelines/templates/steps/integration-rush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ steps:
displayName: "Build test assets"
- ${{if ne(parameters.PreIntegrationSteps, '')}}:
- template: ../steps/${{parameters.PreIntegrationSteps}}.yml
- template: ../steps/${{parameters.PreIntegrationSteps}}.yml

- script: |
node common/scripts/install-run-rush.js integration-test:${{parameters.TestType}} -t "${{parameters.PackageName}}" --verbose
displayName: "Integration test libraries"
env: ${{parameters.EnvVars}}
- ${{if ne(parameters.PostIntegrationSteps, '')}}:
- template: ../steps/${{parameters.PostIntegrationSteps}}.yml
44 changes: 44 additions & 0 deletions sdk/cosmosdb/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# DO NOT EDIT THIS FILE
# This file is generated automatically and any changes will be lost.

trigger:
branches:
include:
- master
- feature/*
paths:
include:
- sdk/cosmosdb/

pr:
branches:
include:
- master
- feature/*
paths:
include:
- sdk/cosmosdb/

jobs:
- template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml
parameters:
# Unit-tests are being skipped. So, matrix is not needed.
Matrix: {}
ServiceDirectory: cosmosdb

- template: ../../eng/pipelines/templates/jobs/archetype-sdk-integration.yml
parameters:
PackagePath: "sdk/cosmosdb/cosmos/"
PackageName: "@azure/cosmos"
Toolchain: rush
Matrix:
Windows_Node8:
OSVmImage: "vs2017-win2016"
NodeVersion: "8.x"
TestType: "node"
PreIntegrationSteps: cosmos-integration-public
PostIntegrationSteps: cosmos-additional-steps
EnvVars:
ACCOUNT_HOST: $(CosmosDbEmulator.Endpoint)
MOCHA_TIMEOUT: 100000
NODE_TLS_REJECT_UNAUTHORIZED: 0
1 change: 1 addition & 0 deletions sdk/cosmosdb/cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"clean": "rimraf dist dist-esm temp types *.tgz *.html *.log *.tsbuildinfo test/**/*.{js,js.map,d.ts}",
"docs": "typedoc --tsconfig ./src/tsconfig.json --excludePrivate --mode file --out ./dist/docs ./src",
"execute:samples": "cd samples && npm run all-samples",
"extract-api": "npm run build:src && api-extractor run --local",
"format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"integration-test:browser": "echo skipped",
Expand Down
3 changes: 2 additions & 1 deletion sdk/cosmosdb/cosmos/samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"ItemManagement": "npx ts-node ./ItemManagement",
"DatabaseManagement": "npx ts-node ./DatabaseManagement",
"IndexManagement": "npx ts-node ./IndexManagement",
"ChangeFeed": "npx ts-node ./ChangeFeed"
"ChangeFeed": "npx ts-node ./ChangeFeed",
"all-samples": "npm run ContainerManagement && npm run UserManagement && npm run ServerSideScripts && npm run ItemManagement && npm run DatabaseManagement && npm run IndexManagement && npm run ChangeFeed"
}
}

0 comments on commit 066aad7

Please sign in to comment.