Skip to content

Commit

Permalink
[Monitor] add Pipelines (#10446)
Browse files Browse the repository at this point in the history
  • Loading branch information
markwolff committed Aug 24, 2020
1 parent ddaed88 commit 7a26e1d
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 4 deletions.
9 changes: 9 additions & 0 deletions eng/pipelines/templates/steps/monitor-additional-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
parameters:
PackagePath: "sdk/monitor/opentelemetry-exporter/"

steps:
- bash: |
node ../../../common/scripts/install-run-rushx.js test-opentelemetry-versions --verbose
condition: succeededOrFailed()
displayName: "Test OpenTelemetry Versions - Monitor"
workingDirectory: "${{parameters.PackagePath}}"
32 changes: 32 additions & 0 deletions sdk/monitor/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# DO NOT EDIT THIS FILE
# This file is generated automatically and any changes will be lost.

trigger:
branches:
include:
- master
- release/*
- hotfix/*
paths:
include:
- sdk/monitor/

pr:
branches:
include:
- master
- feature/*
- release/*
- hotfix/*
paths:
include:
- sdk/monitor/

extends:
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: monitor
RunUnitTests: true
Artifacts:
- name: azure-monitor-opentelemety-exporter
safeName: azuremonitoropentelemetryexporter
10 changes: 6 additions & 4 deletions sdk/monitor/opentelemetry-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
"build": "npm run build:node && npm run build:browser",
"lint": "eslint . --ext .ts",
"test": "npm run test:node && npm run test:browser",
"test:node": "c8 ts-mocha -p ./tsconfig.json 'test/**/*.test.ts'",
"test:browser": "echo skipped",
"test:node": "npm run unit-test:node",
"test:browser": "npm run unit-test:browser",
"unit-test:browser": "echo skipped",
"unit-test:node": "echo skipped",
"unit-test:node": "c8 ts-mocha -p ./tsconfig.json 'test/**/*.test.ts'",
"unit-test:node:no-timeout": "echo skipped",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"integration-test:browser": "echo skipped",
"integration-test:node": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"report": "c8 report --reporter=json",
"test-opentelemetry-versions": "node test-opentelemetry-versions.js 2>&1",
"prepare": "npm run build"
},
"engines": {
Expand All @@ -50,14 +51,15 @@
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@types/mocha": "^7.0.2",
"@types/node": "^10.0.0",
"@typescript-eslint/parser": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"c8": "^7.2.0",
"eslint": "^6.1.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"execa": "^3.3.0",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-no-only-tests": "^2.3.0",
"eslint-plugin-promise": "^4.1.1",
Expand Down
43 changes: 43 additions & 0 deletions sdk/monitor/opentelemetry-exporter/test-opentelemetry-versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const execa = require("execa");

const versions = ["latest", "canary"];

const packageJson = require("./package.json");
const packages = [
...Object.keys(packageJson.dependencies).filter((package) =>
package.startsWith("@opentelemetry")
),
...Object.keys(packageJson.devDependencies).filter((package) =>
package.startsWith("@opentelemetry")
)
];

async function exec(cmd) {
const command = execa(cmd, { cwd: ".", shell: true });
command.stderr.pipe(process.stderr);
command.stdout.pipe(process.stdout);
return command;
}

(async () => {
try {
console.log("Running opentelemetry version test against", versions);
for (const version of versions) {
// Note: this moves devDeps to dependencies, but it does not matter for these tests
const packagesToInstall = packages.map((package) => `${package}@${version}`).join(" ");
console.log(`Installing ${packagesToInstall}`);
await exec(`npm install --no-save ${packagesToInstall}`);

console.log(`Compiling on version: ${version}`);
await exec(`npm run build`);

console.log(`Running tests on version: ${version}`);
await exec(`npm run test`);
}
process.exit(0);
} catch (error) {
console.log("Opentelemetry version test failed!");
console.log(error);
process.exit(1);
}
})();
10 changes: 10 additions & 0 deletions sdk/monitor/opentelemetry-exporter/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
trigger: none

extends:
template: ../../../eng/pipelines/templates/jobs/archetype-sdk-integration.yml
parameters:
TimeoutInMinutes: 15
PackageName: "@azure/monitor-opentelemetry-exporter"
ResourceServiceDirectory: monitor
TestSamples: false
PostIntegrationSteps: monitor-additional-steps

0 comments on commit 7a26e1d

Please sign in to comment.