diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..4e55e04c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,118 @@ +name: build + +on: + push: + branches: + - master + pull_request: + branches: + - master + release: + types: + - released + +env: + NODE_BUILD_CMD: npx prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 -t 20.0.0 + ELECTRON_BUILD_CMD: npx prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 + +jobs: + + test: + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + node: + - 14 + - 16 + - 18 + - 20 + fail-fast: false + name: Testing Node ${{ matrix.node }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + - run: npm install + - run: npm test + + test_windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: npm install + - run: npm run-script test-windows + + publish: + if: ${{ github.event_name == 'release' }} + name: Publishing to NPM + runs-on: ubuntu-latest + needs: [ test, test_windows ] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: https://registry.npmjs.org + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + prebuild: + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + fail-fast: false + name: Prebuild on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + needs: publish + steps: + - uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: npm install --ignore-scripts + - run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }} + - run: ${{ env.ELECTRON_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }} + - if: matrix.os == 'windows-latest' + run: | + ${{ env.NODE_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }} + ${{ env.ELECTRON_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }} + - if: matrix.os == 'macos-latest' + run: | + ${{ env.NODE_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }} + ${{ env.ELECTRON_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }} + + cargo: + runs-on: ubuntu-latest + needs: publish + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - run: cargo publish --token ${CRATESIO_TOKEN} + env: + CRATES_TOKEN: ${{ secrets.CRATESIO_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 9a80e188..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build/test -on: - push: - branches: - - master - pull_request: - branches: - - master -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: [macos-latest, ubuntu-latest] - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 - - uses: actions/setup-node@v3 - with: - node-version: 16 - - run: npm install - - run: npm test - test_windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 - - uses: actions/setup-node@v3 - with: - node-version: 16 - - run: npm install - - run: npm run-script test-windows diff --git a/binding.gyp b/binding.gyp index 3c30f0a4..f0809e51 100644 --- a/binding.gyp +++ b/binding.gyp @@ -13,7 +13,23 @@ ], "cflags_c": [ "-std=c99", - ] + ], + "cflags_cc": ["-std=c++17"], + "xcode_settings": { + "OTHER_CPLUSPLUSFLAGS": ["-std=c++17", "-stdlib=libc++"], + }, + "msvs_settings": { + "VCCLCompilerTool": { + "AdditionalOptions": [ + "/std:c++17", + ], + "RuntimeLibrary": 0, + }, + }, + } - ] + ], + 'variables': { + 'openssl_fips': '', + }, }