From bfe0b44b36932e3b55a0dc4eb4e1fa409906a3e8 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Fri, 15 Oct 2021 09:53:16 -0400 Subject: [PATCH] chore: soft fork changes This commit contains changes that should be rebased on top of upstream. --- .github/workflows/build-and-release.yaml | 199 +++++++++++------------ .github/workflows/publish.yaml | 34 ++++ package.json | 12 +- scripts/module-packaging.js | 2 +- 4 files changed, 132 insertions(+), 115 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/build-and-release.yaml b/.github/workflows/build-and-release.yaml index 5dcc56291..0736ff11a 100644 --- a/.github/workflows/build-and-release.yaml +++ b/.github/workflows/build-and-release.yaml @@ -14,7 +14,7 @@ on: - develop env: - NODE_LIBCURL_GITHUB_TOKEN: ${{ secrets.NODE_LIBCURL_GITHUB_TOKEN }} + NODE_LIBCURL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # all jobs here must have a matrix identical to the ones inside build-lint-test.yaml @@ -26,23 +26,11 @@ jobs: matrix: os: - macos-11 - - ubuntu-16.04 # TODO(jonathan): bump this to a more recent version when we do a major version bump + - ubuntu-18.04 libcurl-release: - 7.73.0 node: - - 10 - 12 - - 14 - - 16 - include: - - os: macos-11 - libcurl-release: 7.73.0 - node: 16 - node-libcurl-cpp-std: c++17 - - os: ubuntu-16.04 - libcurl-release: 7.73.0 - node: 16 - node-libcurl-cpp-std: c++17 env: LIBCURL_RELEASE: ${{ matrix.libcurl-release }} LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }} @@ -54,8 +42,6 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} - - run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV - if: matrix.node-libcurl-cpp-std - if: runner.os == 'macOS' name: Install Needed packages on macOS run: brew install coreutils wget automake libtool cmake gnu-sed m4 @@ -93,9 +79,9 @@ jobs: path: | ~/.node-gyp ~/deps - key: v4-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }} + key: v4-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }}-fork restore-keys: | - v4-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }} + v4-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }}-fork - name: 'Set GIT_TAG' if: startsWith(github.ref, 'refs/tags') run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV @@ -111,47 +97,38 @@ jobs: retention-days: 5 build-and-release-electron: - runs-on: macos-11 + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + os: + - macos-11 + - ubuntu-18.04 libcurl-release: - 7.73.0 node: - - 16 + - 12 electron-version: - - 12.0.0 - 11.2.3 - - 10.1.0 - - 9.3.3 - - 8.5.3 - include: - - libcurl-release: 7.73.0 - node: 16 - electron-version: 12.0.0 - node-libcurl-cpp-std: c++17 - - libcurl-release: 7.73.0 - node: 16 - electron-version: 11.2.3 - node-libcurl-cpp-std: c++17 + - 11.5.0 env: LIBCURL_RELEASE: ${{ matrix.libcurl-release }} LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }} ELECTRON_VERSION: ${{ matrix.electron-version }} - NODE_LIBCURL_CPP_STD: c++11 + NODE_LIBCURL_CPP_STD: c++17 steps: - - run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV - if: matrix.node-libcurl-cpp-std - name: Checkout uses: actions/checkout@main - name: Setup Node.js uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} - - name: Install Needed packages + - if: runner.os == 'macOS' + name: Install Needed packages run: brew install coreutils wget automake libtool cmake gnu-sed m4 # not using brew for that one as we need 2.69 - - name: Install autoconf + - if: runner.os == 'macOS' + name: Install autoconf run: | curl -O -L http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz tar -xzf autoconf-2.69.tar.gz @@ -161,6 +138,9 @@ jobs: make install autoconf --version ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize + - if: runner.os == 'Linux' + name: Install Needed packages on Linux + run: sudo apt-get install -y cmake - name: Output yarn cache dir id: yarn-cache-dir run: echo "::set-output name=dir::$(yarn cache dir)" @@ -188,9 +168,9 @@ jobs: path: | ~/.node-gyp ~/deps - key: v4-${{ runner.os }}-libcurl-deps-cache-electron-${{ matrix.electron-version }} + key: v4-${{ runner.os }}-libcurl-deps-cache-electron-${{ matrix.electron-version }}-fork restore-keys: | - v4-${{ runner.os }}-libcurl-deps-cache-electron-${{ matrix.electron-version }} + v4-${{ runner.os }}-libcurl-deps-cache-electron-${{ matrix.electron-version }}-fork - name: 'Set GIT_TAG' if: startsWith(github.ref, 'refs/tags') run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV @@ -205,87 +185,90 @@ jobs: path: ./logs/ retention-days: 5 - build-and-release-nwjs: - runs-on: macos-11 + build-and-release-nodejs-windows: + runs-on: windows-2016 strategy: fail-fast: false matrix: - libcurl-release: - - 7.73.0 node: - - 16 - nwjs-version: - - 0.52.0 - - 0.51.2 - - 0.49.2 - include: - - libcurl-release: 7.73.0 - node: 16 - nwjs-version: 0.52.0 - node-libcurl-cpp-std: c++17 - - libcurl-release: 7.73.0 - node: 16 - nwjs-version: 0.51.2 - node-libcurl-cpp-std: c++17 + - 12 env: - LIBCURL_RELEASE: ${{ matrix.libcurl-release }} - LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }} - NWJS_VERSION: ${{ matrix.nwjs-version }} - NODE_LIBCURL_CPP_STD: c++11 + npm_config_msvs_version: 2017 + npm_config_build_from_source: true steps: - - run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV - if: matrix.node-libcurl-cpp-std - name: Checkout uses: actions/checkout@main + with: + submodules: recursive - name: Setup Node.js uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} - - name: Install Needed packages - run: brew install coreutils wget automake libtool cmake gnu-sed m4 - # not using brew for that one as we need 2.69 - - name: Install autoconf + - name: Install dependencies run: | - curl -O -L http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz - tar -xzf autoconf-2.69.tar.gz - cd autoconf-* - ./configure - make - make install - autoconf --version - ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize - - name: Output yarn cache dir - id: yarn-cache-dir - run: echo "::set-output name=dir::$(yarn cache dir)" - - name: Restore Yarn Cache - uses: actions/cache@v2 - id: yarn-cache + cinst nasm -y + python deps\curl-for-windows\configure.py + - name: Build + run: | + $env:PATH=$env:PROGRAMFILES + "\NASM;" + $env:Path + yarn install --frozen-lockfile + - name: Test + run: | + yarn ts-node -e "console.log(require('./lib').Curl.getVersionInfoString())" + yarn test + + if ($LASTEXITCODE -eq 0) { + $host.SetShouldExit(0) + } + - name: Publish binary + if: startsWith(github.ref, 'refs/tags/') + run: | + yarn node-pre-gyp package testpackage --verbose + node scripts\module-packaging.js --publish $(yarn -s node-pre-gyp reveal staged_tarball --silent) + + build-and-release-electron-windows: + runs-on: windows-2016 + strategy: + fail-fast: false + matrix: + node: + - 12 + electron-version: + - 11.2.3 + env: + ELECTRON_VERSION: ${{ matrix.electron-version }} + npm_config_msvs_version: 2017 + npm_config_build_from_source: true + npm_config_runtime: "electron" + npm_config_dist_url: "https://atom.io/download/electron" + npm_config_target: ${{ matrix.electron-version }} + steps: + - name: Checkout + uses: actions/checkout@main with: - path: ${{ steps.yarn-cache-dir.outputs.dir }} - key: v1-${{ runner.os }}-yarn-cache-${{ github.ref }}-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - v1-${{ runner.os }}-yarn-cache-${{ github.ref }}- - v1-${{ runner.os }}-yarn-cache- - - name: Restore libcurl deps cache - uses: actions/cache@v2 - id: libcurl-deps-cache + submodules: recursive + - name: Setup Node.js + uses: actions/setup-node@v1 with: - path: | - ~/.node-gyp - ~/deps - key: v4-${{ runner.os }}-libcurl-deps-cache-nwjs-${{ matrix.nwjs-version }} - restore-keys: | - v4-${{ runner.os }}-libcurl-deps-cache-nwjs-${{ matrix.nwjs-version }} - - name: 'Set GIT_TAG' - if: startsWith(github.ref, 'refs/tags') - run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: 'Publish Binary' + node-version: ${{ matrix.node }} + - name: Install dependencies run: | - GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh - - name: Upload artifacts - if: always() - uses: actions/upload-artifact@v2 - with: - name: build-logs - path: ./logs/ - retention-days: 5 + cinst nasm -y + python deps\curl-for-windows\configure.py + yarn global add electron@${env:ELECTRON_VERSION} + - name: Build + run: | + $env:PATH=$env:PROGRAMFILES + "\NASM;" + $env:Path + yarn install --frozen-lockfile + - name: Test + run: | + yarn test:electron + + if ($LASTEXITCODE -eq 0) { + $host.SetShouldExit(0) + } + - name: Publish binary + if: startsWith(github.ref, 'refs/tags/') + run: | + yarn node-pre-gyp package testpackage --verbose + node scripts\module-packaging.js --publish $(yarn -s node-pre-gyp reveal staged_tarball --silent) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 000000000..232245cec --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,34 @@ +name: publish + +on: + push: + tags: + - '*' + +jobs: + publish: + runs-on: ubuntu-18.04 + permissions: + contents: read + packages: write + strategy: + fail-fast: false + matrix: + node: + - 12 + steps: + - name: Checkout + uses: actions/checkout@main + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + registry-url: 'https://registry.npmjs.org' + - name: Install + run: yarn install --ignore-scripts + - name: Build + run: yarn build:dist + - name: Publish Package + run: yarn publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 6c4c14783..cbebfda6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "node-libcurl", - "version": "2.3.3", + "name": "@getinsomnia/node-libcurl", + "version": "v2.3.4-alpha.0", "description": "The fastest http(s) client (and much more) for Node.js - Node.js bindings for libcurl", "keywords": [ "node-curl", @@ -10,13 +10,13 @@ "axios", "request" ], - "homepage": "https://github.com/JCMais/node-libcurl", + "homepage": "https://github.com/Kong/node-libcurl", "bugs": { - "url": "https://github.com/JCMais/node-libcurl/issues" + "url": "https://github.com/Kong/node-libcurl/issues" }, "repository": { "type": "git", - "url": "git://github.com/JCMais/node-libcurl.git" + "url": "git://github.com/Kong/node-libcurl.git" }, "license": "MIT", "author": "Jonathan Cardoso ", @@ -27,7 +27,7 @@ "module_path": "./lib/binding/", "remote_path": "./v{version}/", "package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}-{libc}.tar.gz", - "host": "https://github.com/JCMais/node-libcurl/releases/download" + "host": "https://github.com/Kong/node-libcurl/releases/download" }, "scripts": { "ae": "api-extractor run --local --verbose", diff --git a/scripts/module-packaging.js b/scripts/module-packaging.js index b8cb8a43b..0e5b8280d 100644 --- a/scripts/module-packaging.js +++ b/scripts/module-packaging.js @@ -32,7 +32,7 @@ if (args[0] !== validArgs[0] && args[0] !== validArgs[1]) { } const octo = octonode.client(process.env['NODE_LIBCURL_GITHUB_TOKEN']) -const repo = octo.repo('JCMais/node-libcurl') +const repo = octo.repo('Kong/node-libcurl') const commands = { publish: publish, unpublish: unpublish,