From 5786a9bc7421559319098d8010e871c6510bcb79 Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Fri, 3 Jun 2022 15:49:42 -0700 Subject: [PATCH 1/3] Fix running build on node 18 Two problems: 1. source-map@0.7.3 does not work on node 18 2. need to set --openssl-legacy-provider because webpack is using openssl in a legacy way that was changed in node 17. --- .github/workflows/main.yml | 2 +- extensions/ql-vscode/package-lock.json | 76 +++++++++++++------------- extensions/ql-vscode/package.json | 11 ++-- 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 34b862be6e7..39878e3ff39 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: '16.13.0' + node-version: '18' - name: Install dependencies working-directory: extensions/ql-vscode diff --git a/extensions/ql-vscode/package-lock.json b/extensions/ql-vscode/package-lock.json index db4e3eb15aa..aa8e68cce2b 100644 --- a/extensions/ql-vscode/package-lock.json +++ b/extensions/ql-vscode/package-lock.json @@ -26,6 +26,7 @@ "react": "^17.0.2", "react-dom": "^17.0.2", "semver": "~7.3.2", + "source-map": "git://github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77", "source-map-support": "^0.5.21", "stream": "^0.0.2", "stream-chain": "~2.2.4", @@ -143,6 +144,14 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/generator/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@babel/helper-annotate-as-pure": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz", @@ -6707,15 +6716,6 @@ "node": ">=6" } }, - "node_modules/gulp-typescript/node_modules/source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/gulp-typescript/node_modules/through2": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", @@ -11568,6 +11568,15 @@ "node": ">=0.10.0" } }, + "node_modules/snapdragon/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -11575,11 +11584,12 @@ "dev": true }, "node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "version": "0.7.3", + "resolved": "git+ssh://git@github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77", + "integrity": "sha512-hAd32oS2vDocUz/DVO3LEefqPNK41eStIaFtkRV6uoGZISca5EKZUI5BEgpyQhQ4EBZjkzcJJEXlJFWuTdplcQ==", + "license": "BSD-3-Clause", "engines": { - "node": ">=0.10.0" + "node": ">= 8" } }, "node_modules/source-map-resolve": { @@ -12203,15 +12213,6 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, - "node_modules/terser/node_modules/source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -14160,6 +14161,13 @@ "@babel/types": "^7.16.8", "jsesc": "^2.5.1", "source-map": "^0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + } } }, "@babel/helper-annotate-as-pure": { @@ -19741,12 +19749,6 @@ "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", "dev": true }, - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true - }, "through2": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", @@ -23431,6 +23433,12 @@ "requires": { "is-extendable": "^0.1.0" } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true } } }, @@ -23512,9 +23520,9 @@ "dev": true }, "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + "version": "git+ssh://git@github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77", + "integrity": "sha512-hAd32oS2vDocUz/DVO3LEefqPNK41eStIaFtkRV6uoGZISca5EKZUI5BEgpyQhQ4EBZjkzcJJEXlJFWuTdplcQ==", + "from": "source-map@git://github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77" }, "source-map-resolve": { "version": "0.5.3", @@ -23984,12 +23992,6 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true - }, - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true } } }, diff --git a/extensions/ql-vscode/package.json b/extensions/ql-vscode/package.json index 3169e7c4e26..e247b2cd5b3 100644 --- a/extensions/ql-vscode/package.json +++ b/extensions/ql-vscode/package.json @@ -1115,13 +1115,13 @@ ] }, "scripts": { - "build": "gulp", + "build": "NODE_OPTIONS=--openssl-legacy-provider gulp", "watch": "npm-run-all -p watch:*", - "watch:extension": "tsc --watch", - "watch:webpack": "gulp watchView", - "watch:css": "gulp watchCss", + "watch:extension": "NODE_OPTIONS=--openssl-legacy-provider tsc --watch", + "watch:webpack": "NODE_OPTIONS=--openssl-legacy-provider gulp watchView", + "watch:css": "NODE_OPTIONS=--openssl-legacy-provider gulp watchCss", "test": "mocha --exit -r ts-node/register test/pure-tests/**/*.ts", - "preintegration": "rm -rf ./out/vscode-tests && gulp", + "preintegration": "rm -rf ./out/vscode-tests && npm run build", "integration": "node ./out/vscode-tests/run-integration-tests.js no-workspace,minimal-workspace", "cli-integration": "npm run preintegration && node ./out/vscode-tests/run-integration-tests.js cli-integration", "update-vscode": "node ./node_modules/vscode/bin/install", @@ -1148,6 +1148,7 @@ "react-dom": "^17.0.2", "semver": "~7.3.2", "source-map-support": "^0.5.21", + "source-map": "git://github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77", "stream": "^0.0.2", "stream-chain": "~2.2.4", "stream-json": "~1.7.3", From 491d02ad0c8775617fcede53ca2741ea7ca4a1ee Mon Sep 17 00:00:00 2001 From: Elena Tanasoiu Date: Tue, 14 Jun 2022 15:34:30 +0100 Subject: [PATCH 2/3] Use source-map 0.7.4 A new release of source-map was pushed 10 days ago: https://github.com/mozilla/source-map/releases/tag/v0.7.4 It contains a fix for building on Node 18 (which was added in Oct 2020): https://github.com/mozilla/source-map/issues/423. Let's make use of it! --- extensions/ql-vscode/package-lock.json | 15 +++++++-------- extensions/ql-vscode/package.json | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/extensions/ql-vscode/package-lock.json b/extensions/ql-vscode/package-lock.json index aa8e68cce2b..670ceaac45f 100644 --- a/extensions/ql-vscode/package-lock.json +++ b/extensions/ql-vscode/package-lock.json @@ -26,7 +26,7 @@ "react": "^17.0.2", "react-dom": "^17.0.2", "semver": "~7.3.2", - "source-map": "git://github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77", + "source-map": "^0.7.4", "source-map-support": "^0.5.21", "stream": "^0.0.2", "stream-chain": "~2.2.4", @@ -11584,10 +11584,9 @@ "dev": true }, "node_modules/source-map": { - "version": "0.7.3", - "resolved": "git+ssh://git@github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77", - "integrity": "sha512-hAd32oS2vDocUz/DVO3LEefqPNK41eStIaFtkRV6uoGZISca5EKZUI5BEgpyQhQ4EBZjkzcJJEXlJFWuTdplcQ==", - "license": "BSD-3-Clause", + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", "engines": { "node": ">= 8" } @@ -23520,9 +23519,9 @@ "dev": true }, "source-map": { - "version": "git+ssh://git@github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77", - "integrity": "sha512-hAd32oS2vDocUz/DVO3LEefqPNK41eStIaFtkRV6uoGZISca5EKZUI5BEgpyQhQ4EBZjkzcJJEXlJFWuTdplcQ==", - "from": "source-map@git://github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77" + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==" }, "source-map-resolve": { "version": "0.5.3", diff --git a/extensions/ql-vscode/package.json b/extensions/ql-vscode/package.json index e247b2cd5b3..0772d221ef5 100644 --- a/extensions/ql-vscode/package.json +++ b/extensions/ql-vscode/package.json @@ -1148,7 +1148,7 @@ "react-dom": "^17.0.2", "semver": "~7.3.2", "source-map-support": "^0.5.21", - "source-map": "git://github.com/mozilla/source-map.git#d69af1457a57d242e6b882ebd8aff1d145611b77", + "source-map": "^0.7.4", "stream": "^0.0.2", "stream-chain": "~2.2.4", "stream-json": "~1.7.3", From 7efe3eae99f9b99cc32c3cc8d496cdd5b264cbcb Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Tue, 14 Jun 2022 11:20:57 -0700 Subject: [PATCH 3/3] Ensure the CI uses node 18 and bash --- .github/workflows/main.yml | 62 ++++++++++++++++++++++--------- .github/workflows/release.yml | 23 +++++++----- extensions/ql-vscode/package.json | 8 ++-- 3 files changed, 61 insertions(+), 32 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 39878e3ff39..129d7549f54 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,25 +15,28 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] steps: + - uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 1 - - uses: actions/setup-node@v1 - with: - node-version: '18' - - name: Install dependencies working-directory: extensions/ql-vscode run: | npm install + env: + NODE_OPTIONS: --openssl-legacy-provider shell: bash - name: Build working-directory: extensions/ql-vscode env: APP_INSIGHTS_KEY: '${{ secrets.APP_INSIGHTS_KEY }}' + NODE_OPTIONS: --openssl-legacy-provider run: | npm run build shell: bash @@ -75,50 +78,64 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] steps: + - uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 1 - - uses: actions/setup-node@v1 - with: - node-version: '16.13.0' - - name: Install dependencies + shell: bash working-directory: extensions/ql-vscode + env: + NODE_OPTIONS: --openssl-legacy-provider run: | npm install - shell: bash - name: Build working-directory: extensions/ql-vscode + shell: bash env: + NODE_OPTIONS: --openssl-legacy-provider APP_INSIGHTS_KEY: '${{ secrets.APP_INSIGHTS_KEY }}' run: | npm run build - shell: bash - name: Lint + shell: bash working-directory: extensions/ql-vscode + env: + NODE_OPTIONS: --openssl-legacy-provider run: | npm run lint - name: Run unit tests (Linux) working-directory: extensions/ql-vscode + shell: bash if: matrix.os == 'ubuntu-latest' + env: + NODE_OPTIONS: --openssl-legacy-provider run: | npm run test - name: Run unit tests (Windows) if: matrix.os == 'windows-latest' + shell: bash + env: + NODE_OPTIONS: --openssl-legacy-provider working-directory: extensions/ql-vscode run: | npm run test - name: Run integration tests (Linux) if: matrix.os == 'ubuntu-latest' + shell: bash working-directory: extensions/ql-vscode env: + NODE_OPTIONS: --openssl-legacy-provider VSCODE_CODEQL_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' run: | sudo apt-get install xvfb @@ -126,9 +143,8 @@ jobs: - name: Run integration tests (Windows) if: matrix.os == 'windows-latest' + shell: bash working-directory: extensions/ql-vscode - env: - VSCODE_CODEQL_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' run: | npm run integration @@ -146,24 +162,28 @@ jobs: TEST_CODEQL_PATH: '${{ github.workspace }}/codeql' steps: + - uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Checkout uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: '16.13.0' - - name: Install dependencies working-directory: extensions/ql-vscode + shell: bash + env: + NODE_OPTIONS: --openssl-legacy-provider run: | npm install - shell: bash - name: Build working-directory: extensions/ql-vscode + shell: bash + env: + NODE_OPTIONS: --openssl-legacy-provider run: | npm run build - shell: bash - name: Decide on ref of CodeQL repo id: choose-ref @@ -190,11 +210,17 @@ jobs: - name: Run CLI tests (Linux) working-directory: extensions/ql-vscode if: matrix.os == 'ubuntu-latest' + shell: bash + env: + NODE_OPTIONS: --openssl-legacy-provider run: | /usr/bin/xvfb-run npm run cli-integration - name: Run CLI tests (Windows) working-directory: extensions/ql-vscode if: matrix.os == 'windows-latest' + shell: bash + env: + NODE_OPTIONS: --openssl-legacy-provider run: | npm run cli-integration diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b084159a4c..47fc7722331 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,30 +17,32 @@ jobs: name: Release runs-on: ubuntu-latest steps: + - uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Checkout uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: '16.13.0' - - name: Install dependencies + shell: bash run: | cd extensions/ql-vscode npm ci - shell: bash - name: Build + shell: bash env: + NODE_OPTIONS: --openssl-legacy-provider APP_INSIGHTS_KEY: '${{ secrets.APP_INSIGHTS_KEY }}' run: | echo "APP INSIGHTS KEY LENGTH: ${#APP_INSIGHTS_KEY}" cd extensions/ql-vscode npm run build -- --release - shell: bash - name: Prepare artifacts id: prepare-artifacts + shell: bash run: | mkdir artifacts cp dist/*.vsix artifacts @@ -95,12 +97,14 @@ jobs: # The checkout action does not fetch the main branch. # Fetch the main branch so that we can base the version bump PR against main. - name: Fetch main branch + shell: bash run: | git fetch --depth=1 origin main:main git checkout main - name: Bump patch version id: bump-patch-version + shell: bash if: success() run: | cd extensions/ql-vscode @@ -110,6 +114,7 @@ jobs: echo "::set-output name=next_version::$NEXT_VERSION" - name: Add changelog for next release + shell: bash if: success() run: | cd extensions/ql-vscode @@ -132,8 +137,6 @@ jobs: needs: build environment: publish-vscode-marketplace runs-on: ubuntu-latest - env: - VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }} steps: - name: Download artifact uses: actions/download-artifact@v2 @@ -141,6 +144,7 @@ jobs: name: vscode-codeql-extension - name: Publish to Registry + shell: bash run: | npx vsce publish -p $VSCE_TOKEN --packagePath *.vsix || \ echo "Failed to publish to VS Code Marketplace. \ @@ -152,8 +156,6 @@ jobs: needs: build environment: publish-open-vsx runs-on: ubuntu-latest - env: - OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }} steps: - name: Download artifact uses: actions/download-artifact@v2 @@ -161,5 +163,6 @@ jobs: name: vscode-codeql-extension - name: Publish to Registry + shell: bash run: | npx ovsx publish -p $OPEN_VSX_TOKEN *.vsix diff --git a/extensions/ql-vscode/package.json b/extensions/ql-vscode/package.json index 0772d221ef5..87f33a682f5 100644 --- a/extensions/ql-vscode/package.json +++ b/extensions/ql-vscode/package.json @@ -1115,11 +1115,11 @@ ] }, "scripts": { - "build": "NODE_OPTIONS=--openssl-legacy-provider gulp", + "build": "gulp", "watch": "npm-run-all -p watch:*", - "watch:extension": "NODE_OPTIONS=--openssl-legacy-provider tsc --watch", - "watch:webpack": "NODE_OPTIONS=--openssl-legacy-provider gulp watchView", - "watch:css": "NODE_OPTIONS=--openssl-legacy-provider gulp watchCss", + "watch:extension": "tsc --watch", + "watch:webpack": "gulp watchView", + "watch:css": "gulp watchCss", "test": "mocha --exit -r ts-node/register test/pure-tests/**/*.ts", "preintegration": "rm -rf ./out/vscode-tests && npm run build", "integration": "node ./out/vscode-tests/run-integration-tests.js no-workspace,minimal-workspace",