From 7b6fc1b8b4a3b5e2659991910da447b5cad158c9 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 2 Nov 2022 13:10:33 +0100 Subject: [PATCH 1/3] adopt publish pipeline --- .github/workflows/pr-chat.yml | 25 ++++++++++++++++++ .github/workflows/tests.yml | 10 +++----- .vscode/settings.json | 9 +++++++ README.md | 1 + build/pipeline.yml | 48 +++++++++++++++++++++++++++++++++++ package.json | 1 - 6 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pr-chat.yml create mode 100644 .vscode/settings.json create mode 100644 build/pipeline.yml diff --git a/.github/workflows/pr-chat.yml b/.github/workflows/pr-chat.yml new file mode 100644 index 0000000..3910279 --- /dev/null +++ b/.github/workflows/pr-chat.yml @@ -0,0 +1,25 @@ +name: PR Chat +on: + pull_request_target: + types: [opened, ready_for_review, closed] + +jobs: + main: + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + steps: + - name: Checkout Actions + uses: actions/checkout@v2 + with: + repository: "microsoft/vscode-github-triage-actions" + ref: stable + path: ./actions + - name: Install Actions + run: npm install --production --prefix ./actions + - name: Run Code Review Chat + uses: ./actions/code-review-chat + with: + token: ${{secrets.GITHUB_TOKEN}} + slack_token: ${{ secrets.SLACK_TOKEN }} + slack_bot_name: "VSCodeBot" + notification_channel: codereview diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5734c1c..6a36701 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,14 +10,12 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 16.x - name: Install root project dependencies run: npm install - name: Build and run tests - uses: GabrielBB/xvfb-action@v1.0 - with: - run: npm test \ No newline at end of file + run: npm test \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5dddcad --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "git.branchProtection": [ + "main" + ], + "git.branchProtectionPrompt": "alwaysCommitToNewBranch", + "git.branchRandomName.enable": true, + "githubPullRequests.assignCreated": "${user}", + "githubPullRequests.defaultMergeMethod": "squash" +} \ No newline at end of file diff --git a/README.md b/README.md index a87613c..1f375d8 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![npm Package](https://img.shields.io/npm/v/request-light.svg?style=flat-square)](https://www.npmjs.org/package/request-light) [![NPM Downloads](https://img.shields.io/npm/dm/request-light.svg)](https://npmjs.org/package/request-light) [![Build Status](https://github.com/microsoft/node-request-light/workflows/Tests/badge.svg)](https://github.com/microsoft/node-request-light/workflows/Tests) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) A lightweight request library intended to be used by VSCode extensions. - NodeJS and browser main entry points diff --git a/build/pipeline.yml b/build/pipeline.yml new file mode 100644 index 0000000..d14f158 --- /dev/null +++ b/build/pipeline.yml @@ -0,0 +1,48 @@ +name: $(Date:yyyyMMdd)$(Rev:.r) + +trigger: + branches: + include: + - main +pr: none + +resources: + repositories: + - repository: templates + type: github + name: microsoft/vscode-engineering + ref: main + endpoint: Monaco + +parameters: + - name: publishPackage + displayName: 🚀 Publish request-light + type: boolean + default: false + +extends: + template: azure-pipelines/npm-package/pipeline.yml@templates + parameters: + npmPackages: + - name: request-light + + buildPlatforms: + - name: Linux + nodeVersions: + - 16.x + - name: MacOS + nodeVersions: + - 16.x + - name: Windows + nodeVersions: + - 16.x + + buildSteps: + - script: npm i + displayName: Install dependencies + + testSteps: + - script: npm test + displayName: Test npm package + + publishPackage: ${{ parameters.publishPackage }} diff --git a/package.json b/package.json index 8299ae0..104d00d 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "package": "webpack --mode production --devtool hidden-source-map", "prepublishOnly": "npm run clean && npm run package && tsc -p ./src/test/ && ava ./lib/test/test.js", "clean": "rimraf lib", - "postversion": "git push && git push --tags", "test": "npm run compile && tsc -p ./src/test/ && ava ./lib/test/test.js" } } From dcb72c50107d20fedb0818af741567358d12630c Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 3 Nov 2022 14:01:26 +0100 Subject: [PATCH 2/3] use prepack --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 104d00d..69a7100 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,8 @@ "scripts": { "compile": "webpack", "watch": "webpack --watch", - "package": "webpack --mode production --devtool hidden-source-map", - "prepublishOnly": "npm run clean && npm run package && tsc -p ./src/test/ && ava ./lib/test/test.js", + "bundle": "webpack --mode production --devtool hidden-source-map", + "prepack": "npm run clean && npm run bundle && tsc -p ./src/test/ && ava ./lib/test/test.js", "clean": "rimraf lib", "test": "npm run compile && tsc -p ./src/test/ && ava ./lib/test/test.js" } From 42ec231fd78036bacdf3e24e0b815d3303192c85 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 3 Nov 2022 14:13:25 +0100 Subject: [PATCH 3/3] update pipeline --- build/pipeline.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/build/pipeline.yml b/build/pipeline.yml index d14f158..066d8a1 100644 --- a/build/pipeline.yml +++ b/build/pipeline.yml @@ -26,7 +26,11 @@ extends: npmPackages: - name: request-light - buildPlatforms: + buildSteps: + - script: npm ci + displayName: Install dependencies + + testPlatforms: - name: Linux nodeVersions: - 16.x @@ -35,13 +39,11 @@ extends: - 16.x - name: Windows nodeVersions: - - 16.x - - buildSteps: - - script: npm i - displayName: Install dependencies + - 16.x testSteps: + - script: npm ci + displayName: Install dependencies - script: npm test displayName: Test npm package