Skip to content

Commit

Permalink
Samples and tests for Azure Quantum SDK (Azure#13480)
Browse files Browse the repository at this point in the history
Co-authored-by: Harsha Nalluru <[email protected]>
Co-authored-by: Sarangan Rajamanickam <[email protected]>
  • Loading branch information
3 people authored Feb 4, 2021
1 parent 2d4f843 commit ea5bf30
Show file tree
Hide file tree
Showing 25 changed files with 1,071 additions and 188 deletions.
25 changes: 10 additions & 15 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions sdk/quantum/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/quantum/
- eng/common/

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

extends:
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: quantum
Artifacts:
- name: azure-quantum-jobs
safeName: quantumjobs
5 changes: 5 additions & 0 deletions sdk/quantum/quantum-jobs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release History

## 1.0.0-beta.1 (2021-02-05)

Initial public preview of the @azure/quantum-jobs library.
2 changes: 2 additions & 0 deletions sdk/quantum/quantum-jobs/generate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
autorest --version=3.0.6335 --typescript --use=@autorest/modelerfour@4.15.452 swagger\README.md
rushx build
38 changes: 30 additions & 8 deletions sdk/quantum/quantum-jobs/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// https://github.com/karma-runner/karma-chrome-launcher
process.env.CHROME_BIN = require("puppeteer").executablePath();
require("dotenv").config();
const {
jsonRecordingFilterFunction,
isPlaybackMode,
isSoftRecordMode,
isRecordMode
} = require("@azure/test-utils-recorder");

module.exports = function(config) {
config.set({
Expand All @@ -21,28 +27,31 @@ module.exports = function(config) {
"karma-env-preprocessor",
"karma-coverage",
"karma-sourcemap-loader",
"karma-junit-reporter"
"karma-junit-reporter",
"karma-json-to-file-reporter",
"karma-json-preprocessor"
],

// list of files / patterns to load in the browser
files: [
// polyfill service supporting IE11 missing features
// Promise,String.prototype.startsWith,String.prototype.endsWith,String.prototype.repeat,String.prototype.includes,Array.prototype.includes,Object.keys
"https://cdn.polyfill.io/v2/polyfill.js?features=Promise,String.prototype.startsWith,String.prototype.endsWith,String.prototype.repeat,String.prototype.includes,Array.prototype.includes,Object.keys|always",
"test-browser/index.js",
{ pattern: "test-browser/index.js.map", type: "html", included: false, served: true }
],
"dist-test/index.browser.js",
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true }
].concat(isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []),

// list of files / patterns to exclude
exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["env"]
"**/*.js": ["sourcemap", "env"],
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
// Preprocess source file to calculate code coverage, however this will make source file unreadable
// "test-browser/index.js": ["coverage"]
// "dist-test/index.browser.js": ["coverage"],
"recordings/browsers/**/*.json": ["json"]
},

// inject following environment values into browser testing with window.__env__
Expand All @@ -52,13 +61,16 @@ module.exports = function(config) {
"AZURE_CLIENT_ID",
"AZURE_CLIENT_SECRET",
"AZURE_TENANT_ID",
"SUBSCRIPTION_ID",
"RESOURCE_GROUP",
"WORKSPACE_NAME",
"TEST_MODE"
],

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha", "coverage", "junit"],
reporters: ["mocha", "coverage", "junit", "json-to-file"],

coverageReporter: {
// specify a common output directory
Expand All @@ -81,6 +93,12 @@ module.exports = function(config) {
properties: {} // key value pair of properties to add to the <properties> section of the report
},

jsonToFileReporter: {
// required - to save the recordings of browser tests
filter: jsonRecordingFilterFunction,
outputPath: "."
},

// web server port
port: 9876,

Expand All @@ -97,11 +115,12 @@ module.exports = function(config) {
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// 'ChromeHeadless', 'Chrome', 'Firefox', 'Edge', 'IE'
// --no-sandbox allows our tests to run in Linux without having to change the system.
browsers: ["ChromeHeadlessNoSandbox"],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
flags: ["--no-sandbox"]
flags: ["--no-sandbox", "--disable-web-security"]
}
},

Expand All @@ -116,6 +135,9 @@ module.exports = function(config) {
browserNoActivityTimeout: 600000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserConsoleLogOptions: {
terminal: !isRecordMode()
},

client: {
mocha: {
Expand Down
Loading

0 comments on commit ea5bf30

Please sign in to comment.