Skip to content

Commit

Permalink
[Merge is planed on 2019/04/29] Move scripts from this repo. (Azure#5719
Browse files Browse the repository at this point in the history
)

* Breaking Change2

* Experimental lintdiff

* No more model/semantic/syntax validations in travis-CI.

* Scripts 0.1.8

* Use scripts from @azure/rest-api-specs-scripts

* ts-utils

* fix breaking changes

* momentOfTruthPostProcessing

* momentOfTruthPostProcessing.ts

* remove 'ts-utils.ts'

* Remove `utils`

* postToGitHub.ts

* switch to momentOfTruthUtils

* minor

* Syntax.ts

* semanticValidation.ts

* another try

* minor update

* URL/fix

* OAD ^0.2.13

* update to new scripts.

* Use scripts from `sergey/move-from-specs-repo`.

* simplified model validation.

* preprod

* postToGitHub

* momentOfTruthPostProcessing

* Semantic Validation

* getSwaggers()

* Use `getExamples()` and `getSwaggers()`.

* Update package.json

* Remove travis-CI jobs except branch strategy.

* remove model and semantic validations version 2.
  • Loading branch information
sergey-shandar authored Apr 29, 2019
1 parent 03a7910 commit 781c97f
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 1,085 deletions.
33 changes: 0 additions & 33 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,12 @@ services:
env:
matrix:
- MODE=branchStrategy
- MODE=semantic PR_ONLY=true CHECK_NAME="Semantic Validator"
- MODE=model PR_ONLY=true CHECK_NAME="Model Validator"
- MODE=BreakingChange PR_ONLY=true CHECK_NAME="Breaking Changes"
- MODE=lintdiff PR_ONLY=true CHECK_NAME="Linter Diff" NODE_OPTIONS=--max-old-space-size=8192
matrix:
fast_finish: true
allow_failures:
- env: MODE=model PR_ONLY=true CHECK_NAME="Model Validator"
- env: MODE=BreakingChange PR_ONLY=true CHECK_NAME="Breaking Changes"
install: true
script:
- >-
if [[ $MODE == 'branchStrategy' ]]; then
# Check to ensure CI is not executing for a PR against the master branch in the private repository
! [[ $TRAVIS_PULL_REQUEST != 'false' && $TRAVIS_REPO_SLUG == 'Azure/azure-rest-api-specs-pr' && $TRAVIS_BRANCH == 'master' ]]
fi
- >-
if [[ $MODE == 'semantic' ]]; then
npm install
npm run tsc
node scripts/semanticValidation.js
fi
- >-
if [[ $MODE == 'model' ]]; then
npm install
npm run tsc
node scripts/modelValidation.js
fi
- >-
if [[ $MODE == 'BreakingChange' ]]; then
scripts/install-dotnet.sh
npm install
npm run tsc
node scripts/breaking-change.js
fi
- >-
if [[ $MODE == 'lintdiff' ]]; then
scripts/install-dotnet.sh
npm install
npm run tsc
node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js
fi
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
],
"url":"https://raw.githubusercontent.com/Azure/autorest/master/schema/composite-swagger.json"
}
]
],
"typescript.tsdk": "node_modules\\typescript\\lib"
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"@azure/avocado": "^0.4.1",
"@azure/oad": "^0.6.3",
"@azure/rest-api-specs-scripts": "^0.2.21",
"@azure/rest-api-specs-scripts": "^0.3.9",
"@microsoft.azure/async-io": "^2.0.21",
"@microsoft.azure/literate": "^1.0.25",
"@microsoft.azure/polyfill": "^1.0.19",
Expand All @@ -21,6 +21,7 @@
"@ts-common/fs": "0.2.0",
"@types/fs-extra": "^5.0.5",
"@types/js-yaml": "^3.12.1",
"@types/mocha": "^5.2.6",
"@types/request": "^2.48.1",
"fs-extra": "^7.0.1",
"glob": "^7.1.3",
Expand All @@ -31,7 +32,7 @@
"request": "^2.88.0",
"request-promise-native": "^1.0.7",
"ts-node": "^8.1.0",
"typescript": "^3.4.3",
"typescript": "^3.4.4",
"z-schema": "^4.0.2"
},
"homepage": "https://github.com/azure/azure-rest-api-specs",
Expand Down
4 changes: 2 additions & 2 deletions preproduction-azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
inputs:
verbose: false
- script: 'npm install -D @azure/rest-api-specs-scripts@0.3.9'
- script: 'npm run tsc && node scripts/semanticValidation2.js'
- script: 'npm run tsc && node scripts/semanticValidation.js'
displayName: 'Semantic Validation'

- job: "ModelValidation"
Expand All @@ -63,7 +63,7 @@ jobs:
inputs:
verbose: false
- script: 'npm install -D @azure/rest-api-specs-scripts@0.3.9'
- script: 'npm run tsc && node scripts/modelValidation2.js'
- script: 'npm run tsc && node scripts/modelValidation.js'
displayName: 'Model Validation'

- job: "Avocado"
Expand Down
39 changes: 2 additions & 37 deletions scripts/modelValidation.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License in the project root for license information.

import { devOps, cli } from '@azure/avocado'
import { utils } from '@azure/rest-api-specs-scripts'
import * as cp from 'child_process'
import { modelValidation } from '@azure/rest-api-specs-scripts'

const exec = (cmd: string, options?: cp.SpawnSyncOptions) => {
const result = cp.spawnSync(
cmd,
{
...options,
shell: true,
stdio: [process.stdin, process.stdout, process.stderr]
}
)
return result.status
}

async function main() {
const pr = await devOps.createPullRequestProperties(cli.defaultConfig())
const swaggersToProcess = await utils.getFilesChangedInPR(pr);
let result = 0
for (const swagger of swaggersToProcess) {
try {
// await oav.validateExamples(swagger, null, {consoleLogLevel: 'error', pretty: true});
// run OAV as a separate process to avoid memory issues.
const r = exec(`node node_modules/oav/dist/cli.js validate-example ${swagger} --pretty`)
if (result === 0) {
result = r
}
} catch (e) {
console.error("error: ")
console.error(e)
result = 1
}
}
process.exitCode = result
}

main().catch(e => { console.log(e); process.exit(1); })
modelValidation.main().catch(e => { console.log(e); process.exit(1); })
7 changes: 0 additions & 7 deletions scripts/modelValidation2.js

This file was deleted.

Loading

0 comments on commit 781c97f

Please sign in to comment.