chore: onboard onto unified pipeline (#13)

* chore: update CI version

* chore: onboard onto unified pipeline

* fix: use GitHub workflow for CI tests

* chore: update .npmignore

* chore: update CI

* chore: add more flags for Binskim

* chore: trim trailing whitespace

* Apply PR feedback

* Remove .github directory from .npmignore

* fix: use SpectreMitigation attribute
This commit is contained in:
Raymond Zhao 2023-03-06 09:00:43 -08:00 коммит произвёл GitHub
Родитель ce26e8f533
Коммит 992725790b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 106 добавлений и 40 удалений

Просмотреть файл

@ -1,2 +1,3 @@
test
build
build
pipelines

Просмотреть файл

@ -1,26 +0,0 @@
trigger:
branches:
include: ['*']
tags:
include: ['*']
pool:
vmImage: windows-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
displayName: 'Use Yarn 1.x'
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@2
displayName: 'Install dependencies'
- task: Npm@1
displayName: 'Publish to NPM'
inputs:
command: publish
verbose: false
publishEndpoint: 'NPM joaomoreno.ms'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))

Просмотреть файл

@ -9,11 +9,16 @@
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
'msvs_configuration_attributes': {
'SpectreMitigation': 'Spectre'
},
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/Qspectre',
'/guard:cf'
'/guard:cf',
'/ZH:SHA_256',
'/we4244',
'/we4267'
]
},
'VCLinkerTool': {

20
pipelines/main.yml Normal file
Просмотреть файл

@ -0,0 +1,20 @@
stages:
- stage: Windows
pool:
vmImage: windows-latest
jobs:
- job: win_x64
variables:
VSCODE_ARCH: x64
steps:
- template: templates/windows.yml
- job: win_ia32
variables:
VSCODE_ARCH: ia32
steps:
- template: templates/windows.yml
trigger:
branches:
include:
- main

47
pipelines/publish.yml Normal file
Просмотреть файл

@ -0,0 +1,47 @@
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 windows-mutex
type: boolean
default: false
extends:
template: azure-pipelines/npm-package/pipeline.yml@templates
parameters:
npmPackages:
- name: windows-mutex
buildSteps:
- script: yarn --frozen-lockfile
displayName: Install dependencies
# the rest of the build steps are part of the 'prepack' script, automatically run when the pipeline invokes 'yarn pack'
testPlatforms:
- name: Windows
nodeVersions:
- 16.x
testSteps:
- script: yarn --frozen-lockfile
displayName: Install dependencies
- script: yarn test
displayName: Compile & test npm package
publishPackage: ${{ parameters.publishPackage }}

Просмотреть файл

@ -0,0 +1,19 @@
steps:
- task: NodeTool@0
inputs:
versionSpec: '16.x'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true
- powershell: |
$env:npm_config_arch="$(VSCODE_ARCH)"
yarn install --frozen-lockfile
displayName: Install Dependencies
- powershell: |
yarn test
displayName: Run Tests
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'))

Просмотреть файл

@ -5,7 +5,7 @@
NAN_MODULE_INIT(Init) {
Nan::Set(target, Nan::New("isActive").ToLocalChecked(),
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(isActive)).ToLocalChecked());
Mutex::Init(target);
}

Просмотреть файл

@ -4,18 +4,18 @@ NAN_METHOD(isActive) {
if (!info[0]->IsString()) {
return Nan::ThrowError(Nan::Error("Provide a mutex name"));
}
const char *name = *Nan::Utf8String(info[0]);
HANDLE mutex = OpenMutex(
SYNCHRONIZE,
FALSE,
name
);
if (mutex != NULL) {
CloseHandle(mutex);
}
info.GetReturnValue().Set(mutex != NULL);
}
@ -47,18 +47,18 @@ NAN_METHOD(Mutex::New) {
if (!info[0]->IsString()) {
return Nan::ThrowError(Nan::Error("Provide a mutex name"));
}
const char *name = *Nan::Utf8String(info[0]);
HANDLE mutex = CreateMutex(
NULL,
TRUE,
name
);
if (mutex == NULL) {
return Nan::ThrowError(Nan::Error("Error creating mutex"));
}
Mutex *obj = new Mutex(name, mutex);
obj->Wrap(info.This());
info.GetReturnValue().Set(info.This());
@ -73,12 +73,12 @@ NAN_METHOD(Mutex::New) {
NAN_METHOD(Mutex::Release) {
Mutex* obj = Nan::ObjectWrap::Unwrap<Mutex>(info.This());
if (!obj->mutex_) {
info.GetReturnValue().Set(FALSE);
return;
}
CloseHandle(obj->mutex_);
obj->mutex_ = NULL;
info.GetReturnValue().Set(TRUE);
@ -86,6 +86,6 @@ NAN_METHOD(Mutex::Release) {
NAN_METHOD(Mutex::IsActive) {
Mutex* obj = Nan::ObjectWrap::Unwrap<Mutex>(info.This());
info.GetReturnValue().Set(obj->mutex_ != NULL);
}

Просмотреть файл

@ -18,7 +18,7 @@ private:
static NAN_METHOD(Release);
static NAN_METHOD(IsActive);
static Nan::Persistent<v8::Function> constructor;
const char* name_;
HANDLE mutex_;
};