diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 906ec387..461c6a76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,8 @@ name: ci on: - - pull_request - - push + pull_request: + push: + branches: [master] jobs: Test: @@ -13,24 +14,36 @@ jobs: os: - ubuntu-latest - macos-latest - - windows-latest + - windows-2019 + node_version: + - 10 + - 12 + - 14 name: Node ${{ matrix.node_version }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | 'node_modules' key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json') }} - name: Setup node - uses: actions/setup-node@v2-beta + uses: actions/setup-node@v3 with: - node-version: 14 + node-version: ${{ matrix.node_version }} + architecture: x64 + + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + with: + vcvarsall: true + architecture: x64 + python: true - name: Install dependencies run: npm install diff --git a/README.md b/README.md index c39c6ea5..8387b218 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Superstring -[![ci](https://github.com/atom/superstring/actions/workflows/ci.yml/badge.svg)](https://github.com/atom/superstring/actions/workflows/ci.yml) +[![macOS Build Status](https://circleci.com/gh/atom/superstring/tree/master.svg?style=shield)](https://circleci.com/gh/atom/superstring) +[![Dependency Status](https://david-dm.org/atom/superstring.svg)](https://david-dm.org/atom/superstring) + + Native library at the core of Atom's text editor. diff --git a/binding.gyp b/binding.gyp index 249e9e82..cce9d221 100644 --- a/binding.gyp +++ b/binding.gyp @@ -67,7 +67,9 @@ ], "variables": { - "tests": 0 + "tests": 0, + "STANDARD": 17, + "MACOSX_DEPLOYMENT_TARGET": "10.15" }, "conditions": [ @@ -100,25 +102,24 @@ "conditions": [ ['OS=="mac"', { 'cflags': [ - '-mmacosx-version-min=10.8' + "-mmacosx-version-min=<(MACOSX_DEPLOYMENT_TARGET)" ], "xcode_settings": { "GCC_ENABLE_CPP_EXCEPTIONS": "YES", - 'MACOSX_DEPLOYMENT_TARGET': '10.8', + 'MACOSX_DEPLOYMENT_TARGET': '<(MACOSX_DEPLOYMENT_TARGET)', } }] ] }] }] ], - "target_defaults": { - "cflags_cc": ["-std=c++11"], + "cflags_cc": [ "-std=c++<(STANDARD)" ], "conditions": [ ['OS=="mac"', { "xcode_settings": { 'CLANG_CXX_LIBRARY': 'libc++', - 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', + 'CLANG_CXX_LANGUAGE_STANDARD':'c++(STANDARD)', } }], ['OS=="win"', { @@ -129,6 +130,40 @@ "NOMINMAX" ], }] - ] - } + ], + 'default_configuration': 'Release', + 'configurations': { + # Release Settings + 'Release': { + 'defines': [ 'NDEBUG' ], + "cflags": [ "-fno-exceptions", "-O3" ], + "cflags_cc": [ "-fno-exceptions", "-O3", "-std=c++<(STANDARD)" ], + "xcode_settings": { + 'GCC_OPTIMIZATION_LEVEL': '3', # stop gyp from defaulting to -Os + "CLANG_CXX_LIBRARY": "libc++", + "CLANG_CXX_LANGUAGE_STANDARD": "c++<(STANDARD)", + 'MACOSX_DEPLOYMENT_TARGET': "<(MACOSX_DEPLOYMENT_TARGET)" + }, # XCODE + "msvs_settings": { + "VCCLCompilerTool": { + 'ExceptionHandling': 0, # /EHsc + 'MultiProcessorCompilation': 'true', + 'RuntimeTypeInfo': 'false', + 'Optimization': 3, # full optimizations /O2 == /Og /Oi /Ot /Oy /Ob2 /GF /Gy + 'StringPooling': 'true', # pool string literals + "AdditionalOptions": [ + # C++ standard + "/std:c++<(STANDARD)", + + # Optimizations + "/O2", + # "/Ob3", # aggressive inline + "/GL", # whole Program Optimization # /LTCG is implied with /GL. + "/DNDEBUG" # turn off asserts + ], + } + } # MSVC + }, # Release + }, # configurations + } # target-defaults } diff --git a/package.json b/package.json index d5df9424..6c67263c 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,12 @@ "browser": "./browser", "scripts": { "build:node": "node-gyp rebuild", - "build:browser": "script/build-browser-version.sh", + "build:browser": "bash -c script/build-browser-version.sh || echo 'the browser build is unsupported'", "build": "npm run build:node && npm run build:browser", "test:native": "node ./script/test-native.js", "test:node": "mocha test/js/*.js", - "test:browser": "SUPERSTRING_USE_BROWSER_VERSION=1 mocha test/js/*.js", - "test": "npm run test:node && npm run test:browser", + "test:browser": "cross-env SUPERSTRING_USE_BROWSER_VERSION=1 mocha test/js/*.js || echo 'the browser tests are unsupported'", + "test": "npm run test:node && npm run test:native && npm run test:browser", "benchmark": "node benchmark/marker-index.benchmark.js", "prepublishOnly": "git submodule update --init --recursive && npm run build:browser", "standard": "standard --recursive src test" @@ -35,6 +35,7 @@ }, "devDependencies": { "chai": "^2.0.0", + "cross-env": "^7.0.3", "mocha": "^2.3.4", "random-seed": "^0.2.0", "standard": "^4.5.4",