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:
Родитель
ce26e8f533
Коммит
992725790b
|
@ -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': {
|
||||
|
|
|
@ -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
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
18
src/mutex.cc
18
src/mutex.cc
|
@ -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_;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче