From 0180e2a33bcdb5dad650c50953481268afc6114c Mon Sep 17 00:00:00 2001 From: Chaoyi Yuan Date: Thu, 9 Jan 2025 21:32:01 +0800 Subject: [PATCH] build: add pipelines (#374) * build: add pipelines * build: update CI pipeline * build: use windows runner --- .azure-pipelines/1esmain.yml | 42 +++++++++++++++++++ .azure-pipelines/SignExtension.signproj | 29 +++++++++++++ .../compliance/CredScanSuppressions.json | 4 -- .azure-pipelines/compliance/tsaoptions.json | 18 ++++++++ .azure-pipelines/release.yml | 36 ++++++++++++++++ .github/workflows/CI.yml | 33 +++++++++++++++ .nvmrc | 1 + package.json | 3 +- 8 files changed, 160 insertions(+), 6 deletions(-) create mode 100644 .azure-pipelines/1esmain.yml create mode 100644 .azure-pipelines/SignExtension.signproj create mode 100644 .azure-pipelines/compliance/tsaoptions.json create mode 100644 .azure-pipelines/release.yml create mode 100644 .github/workflows/CI.yml create mode 100644 .nvmrc diff --git a/.azure-pipelines/1esmain.yml b/.azure-pipelines/1esmain.yml new file mode 100644 index 00000000..345b8ea6 --- /dev/null +++ b/.azure-pipelines/1esmain.yml @@ -0,0 +1,42 @@ +# Trigger the build whenever `main` or `rel/*` is updated +trigger: + - main + - rel/* + +# Disable PR trigger +pr: none + +# Scheduled nightly build of `main` +schedules: + - cron: "0 0 * * *" + displayName: Nightly scheduled build + always: false # Don't rebuild if there haven't been changes + branches: + include: + - main + +# `resources` specifies the location of templates to pick up, use it to get AzExt templates +resources: + repositories: + - repository: azExtTemplates + type: github + name: microsoft/vscode-azuretools + ref: main + endpoint: GitHub-AzureTools # The service connection to use when accessing this repository + +parameters: + - name: enableLongRunningTests + displayName: Enable Long Running Tests + type: boolean + default: true + +variables: + # Required by MicroBuild template + - name: TeamName + value: "Azure Tools for VS Code" + +# Use those templates +extends: + template: azure-pipelines/1esmain.yml@azExtTemplates + parameters: + useAzureFederatedCredentials: ${{ parameters.enableLongRunningTests }} \ No newline at end of file diff --git a/.azure-pipelines/SignExtension.signproj b/.azure-pipelines/SignExtension.signproj new file mode 100644 index 00000000..6e09800a --- /dev/null +++ b/.azure-pipelines/SignExtension.signproj @@ -0,0 +1,29 @@ + + + + net8.0 + + + + + + VSCodePublisher + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + + \ No newline at end of file diff --git a/.azure-pipelines/compliance/CredScanSuppressions.json b/.azure-pipelines/compliance/CredScanSuppressions.json index 3086a737..47de4b98 100644 --- a/.azure-pipelines/compliance/CredScanSuppressions.json +++ b/.azure-pipelines/compliance/CredScanSuppressions.json @@ -4,10 +4,6 @@ { "folder": "node_modules\\", "_justification": "No need to scan external node modules." - }, - { - "folder": "resources\\backupTemplates\\", - "_justification": "No need to scan backup templates." } ] } \ No newline at end of file diff --git a/.azure-pipelines/compliance/tsaoptions.json b/.azure-pipelines/compliance/tsaoptions.json new file mode 100644 index 00000000..b1ff7c63 --- /dev/null +++ b/.azure-pipelines/compliance/tsaoptions.json @@ -0,0 +1,18 @@ +{ + "tsaVersion": "TsaV2", + "codeBase": "NewOrUpdate", + "codeBaseName": "vscode-apimanagement", + "tsaStamp": "DevDiv", + "notificationAliases": [ + "shenwedr@microsoft.com" + ], + "codebaseAdmins": [ + "fareast\\chyuan", + "fareast\\shenwe" + ], + "instanceUrl": "https://devdiv.visualstudio.com", + "projectName": "DevDiv", + "areaPath": "DevDiv\\API Catalog Tooling", + "iterationPath": "DevDiv", + "allTools": true +} \ No newline at end of file diff --git a/.azure-pipelines/release.yml b/.azure-pipelines/release.yml new file mode 100644 index 00000000..83825e7b --- /dev/null +++ b/.azure-pipelines/release.yml @@ -0,0 +1,36 @@ +trigger: none + +parameters: + - name: publishVersion + displayName: Version to publish + type: string + - name: dryRun + displayName: Dry run + type: boolean + default: false + +resources: + pipelines: + - pipeline: build + source: \API Catalog Tooling\VSCode\Extensions\vscode-apimanagement # CUSTOMIZE - location of the pipeline that produces the artifacts + repositories: + - repository: azExtTemplates + type: github + name: microsoft/vscode-azuretools + ref: main + endpoint: GitHub-AzureTools + +variables: + # Required by MicroBuild template + - name: TeamName + value: "API Catalog Tooling" # CUSTOMIZE + +# Use those templates +extends: + template: azure-pipelines/release-extension.yml@azExtTemplates + parameters: + pipelineID: $(resources.pipeline.build.pipelineID) + runID: $(resources.pipeline.build.runID) + publishVersion: ${{ parameters.publishVersion }} + dryRun: ${{ parameters.dryRun }} + environmentName: VscodeApimExtDeploy # CUSTOMIZE \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 00000000..12cd7151 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,33 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + # Disable lint check temporary before we fix all the lint issues + # - name: Lint + # run: npm run lint + + - name: Run tests + run: npm run test \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..25bf17fc --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 \ No newline at end of file diff --git a/package.json b/package.json index 72ab7b30..b8df25e8 100644 --- a/package.json +++ b/package.json @@ -805,12 +805,11 @@ }, "scripts": { "vscode:prepublish": "npm run webpack-prod", - "build": "tsc -p ./", + "build": "tsc -p ./ && gulp webpack-prod", "compile": "tsc -watch -p ./", "package": "vsce package", "lint": "tslint --project tsconfig.json -e src/*.d.ts -t verbose", "lint-fix": "tslint --project tsconfig.json -t verbose --fix", - "pretest": "npm run build && npm run webpack", "test": "vscode-test", "watch": "tsc -watch -p ./", "all": "npm i && npm run lint && npm test",