Skip to content

Commit

Permalink
vscode related changes for releasing @vscode/5.1.2-vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Nov 14, 2022
1 parent 1980f10 commit 159f530
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 204 deletions.
180 changes: 16 additions & 164 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,174 +1,26 @@
name: CI
name: Electron CI

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
tags:
- '*'
env:
FORCE_COLOR: 1
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
branches: [ vscode ]
pull_request:

jobs:
build:
posix:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
host:
- x64
target:
- x64
node:
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
include:
- os: windows-latest
node: 16
host: x86
target: x86
- os: macos-m1
node: 16
host: arm64
target: arm64
name: ${{ matrix.os }} (node=${{ matrix.node }}, host=${{ matrix.host }}, target=${{ matrix.target }})
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.host }}

- name: Add yarn (self-hosted)
if: matrix.os == 'macos-m1'
run: npm install -g yarn

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
if: contains(matrix.os, 'windows')
with:
msbuild-architecture: ${{ matrix.target }}

- name: Install dependencies
run: yarn install --ignore-scripts

- name: Add env vars
shell: bash
run: |
echo "V=1" >> $GITHUB_ENV
if [ "${{ matrix.target }}" = "x86" ]; then
echo "TARGET=ia32" >> $GITHUB_ENV
else
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
fi
- name: Add Linux env vars
if: contains(matrix.os, 'ubuntu')
run: |
echo "CFLAGS=${CFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV
echo "CXXFLAGS=${CXXFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV
- name: Configure build
run: yarn node-pre-gyp configure --target_arch=${{ env.TARGET }}

- name: Build binaries
run: yarn node-pre-gyp build --target_arch=${{ env.TARGET }}

- name: Print binary info
if: contains(matrix.os, 'ubuntu')
run: |
ldd lib/binding/*/node_sqlite3.node
echo "---"
nm lib/binding/*/node_sqlite3.node | grep "GLIBC_" | c++filt || true
echo "---"
file lib/binding/napi-v*/*
- name: Run tests
run: yarn test

- name: Package prebuilt binaries
run: yarn node-pre-gyp package --target_arch=${{ env.TARGET }}

- name: Upload binaries to commit artifacts
uses: actions/upload-artifact@v3
if: matrix.node == 16
with:
name: prebuilt-binaries
path: build/stage/*/*
retention-days: 7

- name: Upload binaries to GitHub Release
run: yarn node-pre-gyp-github publish
if: matrix.node == 16 && startsWith(github.ref, 'refs/tags/')
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ github.token }}
build-qemu:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
- uses: actions/checkout@v2
- run: yarn install
- run: scripts/test-electron.sh
windows:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node:
- 16
target:
- linux/arm64
variant:
- bullseye
- alpine3.15
include:
# musl x64 builds
- target: linux/amd64
variant: alpine3.15
node: 16
name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }})
os: [windows-latest]
steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build binaries and test
run: |
docker buildx build \
--file ./tools/BinaryBuilder.Dockerfile \
--load \
--tag sqlite-builder \
--platform ${{ matrix.target }} \
--no-cache \
--build-arg VARIANT=${{ matrix.variant }} \
--build-arg NODE_VERSION=${{ matrix.node }} \
.
CONTAINER_ID=$(docker create -it sqlite-builder)
docker cp $CONTAINER_ID:/usr/src/build/build/ ./build
- name: Upload binaries to commit artifacts
uses: actions/upload-artifact@v3
if: matrix.node == 16
with:
name: prebuilt-binaries
path: build/stage/*/*
retention-days: 7

- name: Upload binaries to GitHub Release
run: yarn install --ignore-scripts && yarn node-pre-gyp-github publish
if: matrix.node == 16 && startsWith(github.ref, 'refs/tags/')
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ github.token }}
- uses: actions/checkout@v2
- run: yarn install
- run: .\scripts\test-electron.bat
3 changes: 3 additions & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
disturl "https://electronjs.org/headers"
target "19.1.3"
runtime "electron"
41 changes: 41 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).

If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
43 changes: 28 additions & 15 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,28 @@
},
"targets": [
{
"target_name": "<(module_name)",
"target_name": "vscode-sqlite3",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"xcode_settings": { "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"CLANG_CXX_LIBRARY": "libc++",
"MACOSX_DEPLOYMENT_TARGET": "10.7",
# Target depends on
# https://chromium.googlesource.com/chromium/src/+/master/build/config/mac/mac_sdk.gni#22
"MACOSX_DEPLOYMENT_TARGET": "10.11",
},
"msvs_settings": {
"VCCLCompilerTool": { "ExceptionHandling": 1 },
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"AdditionalOptions": [
'/Qspectre',
'/guard:cf'
]
},
"VCLinkerTool": {
"AdditionalOptions": [
'/guard:cf'
]
}
},
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")"],
Expand Down Expand Up @@ -49,18 +62,18 @@
"src/node_sqlite3.cc",
"src/statement.cc"
],
"defines": [ "NAPI_VERSION=<(napi_build_version)", "NAPI_DISABLE_CPP_EXCEPTIONS=1" ]
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS=1", "NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS" ]
},
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}
#{
# "target_name": "action_after_build",
# "type": "none",
# "dependencies": [ "<(module_name)" ],
# "copies": [
# {
# "files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
# "destination": "<(module_path)"
# }
# ]
#}
]
}
6 changes: 3 additions & 3 deletions lib/sqlite3-binding.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const binary = require('@mapbox/node-pre-gyp');
/*const binary = require('@mapbox/node-pre-gyp');
const path = require('path');
const binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
const binding = require(binding_path);
const binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));*/
const binding = require('../build/Release/vscode-sqlite3.node');
module.exports = exports = binding;
29 changes: 7 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "sqlite3",
"name": "@vscode/sqlite3",
"description": "Asynchronous, non-blocking SQLite3 bindings",
"version": "5.1.2",
"homepage": "https://github.com/TryGhost/node-sqlite3",
"version": "5.1.2-vscode",
"homepage": "https://github.com/microsoft/vscode-node-sqlite3",
"author": {
"name": "Mapbox",
"url": "https://mapbox.com/"
Expand Down Expand Up @@ -45,33 +45,18 @@
],
"repository": {
"type": "git",
"url": "https://github.com/TryGhost/node-sqlite3.git"
"url": "https://github.com/microsoft/vscode-node-sqlite3.git"
},
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.0",
"node-addon-api": "^4.2.0",
"tar": "^6.1.11"
},
"devDependencies": {
"eslint": "6.8.0",
"mocha": "7.2.0",
"node-pre-gyp-github": "1.4.4"
},
"peerDependencies": {
"node-gyp": "8.x"
},
"peerDependenciesMeta": {
"node-gyp": {
"optional": true
}
},
"optionalDependencies": {
"node-gyp": "8.x"
"electron": "19.1.3",
"eslint": "^7.32.0",
"mocha": "7.2.0"
},
"scripts": {
"build": "node-pre-gyp build",
"build:debug": "node-pre-gyp build --debug",
"install": "node-pre-gyp install --fallback-to-build",
"pretest": "node test/support/createdb.js",
"test": "mocha -R spec --timeout 480000",
"pack": "node-pre-gyp package"
Expand Down
13 changes: 13 additions & 0 deletions scripts/test-electron.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@echo off
setlocal

pushd %~dp0\..

set ELECTRON_RUN_AS_NODE=1

call .\node_modules\.bin\electron .\test\support/createdb.js
call .\node_modules\.bin\electron .\node_modules\.bin\mocha -R spec --timeout 480000

popd

endlocal
6 changes: 6 additions & 0 deletions scripts/test-electron.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

export ELECTRON_RUN_AS_NODE=1

./node_modules/.bin/electron ./test/support/createdb.js
./node_modules/.bin/electron ./node_modules/.bin/mocha -R spec --timeout 480000
Loading

0 comments on commit 159f530

Please sign in to comment.