diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5fccea42..6c4f21d6 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,5 +1,9 @@ name: on push or pull_request +concurrency: + group: push-on-${{ github.event_name }}-from-${{ github.ref_name }} + cancel-in-progress: true + on: push: branches: @@ -19,6 +23,7 @@ jobs: - version: 14.x - version: 16.x - version: 18.x + - version: 20.x # These error with "Unexpected input(s) 'node-mirror' ...": # - version: 19.x # mirror: https://nodejs.org/download/nightly @@ -28,11 +33,13 @@ jobs: # Temporarily disable MacOS until # https://github.com/nodejs/node/issues/32981 is fixed # TODO(mmarchini): test on 20.04 (need different lldb version) - os: [ubuntu-18.04, ubuntu-20.04] - llvm: [8, 9, 10, 11, 12, 13, 14] + os: [ubuntu-20.04, ubuntu-22.04] + llvm: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] exclude: - # This errors due to a glibc incompatibility. - - {os: ubuntu-18.04, node: {version: 18.x}} + # Neither LLVM nor Canonical package these versions for Jammy + - {os: ubuntu-22.04, llvm: 8} + - {os: ubuntu-22.04, llvm: 9} + - {os: ubuntu-22.04, llvm: 10} steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node.version }} ${{ matrix.node.mirror }} @@ -44,25 +51,51 @@ jobs: - name: install dependencies Linux if: startsWith(matrix.os, 'ubuntu-') run: | - use_llvm_repos=0 + use_llvm_repos=1 - case "${{ matrix.os }}-${{ matrix.llvm }}" in - ubuntu-18.04-10) use_llvm_repos=1;; - ubuntu-18.04-11) use_llvm_repos=1;; - ubuntu-18.04-12) use_llvm_repos=1;; - ubuntu-18.04-13) use_llvm_repos=1;; - ubuntu-18.04-14) use_llvm_repos=1;; - ubuntu-20.04-13) use_llvm_repos=1;; - ubuntu-20.04-14) use_llvm_repos=1;; - *) use_llvm_repos=0;; + case "${{ matrix.os }}" in + ubuntu-20.04) + case "${{ matrix.llvm }}" in + 8) use_llvm_repos=0;; + 9) use_llvm_repos=0;; + 10) use_llvm_repos=0;; + 11) use_llvm_repos=0;; + 12) use_llvm_repos=0;; + *) use_llvm_repos=1;; + esac + ;; + ubuntu-22.04) + case "${{ matrix.llvm }}" in + 11) use_llvm_repos=0;; + 12) use_llvm_repos=0;; + 13) use_llvm_repos=0;; + 14) use_llvm_repos=0;; + 15) use_llvm_repos=0;; + *) use_llvm_repos=1;; + esac + ;; + *) use_llvm_repos=1;; esac if [[ ${use_llvm_repos} == 1 ]]; then + llvm_suffix="-${{ matrix.llvm }}"; + # If there's no `release/XY.x` branch, check if this is current dev release + if ! git ls-remote --exit-code --heads \ + https://github.com/llvm/llvm-project.git \ + refs/heads/release/${{ matrix.llvm }}.x >/dev/null 2>&1; then + # If there's an `llvmorg-XY-init` tag, this is the current dev release + if git ls-remote --exit-code --tags \ + https://github.com/llvm/llvm-project.git \ + refs/tags/llvmorg-${{ matrix.llvm }}-init >/dev/null 2>&1; then + # The dev release doesn't use a version suffix + llvm_suffix=""; + fi + fi wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -; release="$(lsb_release -cs)" - cat << EOF | sudo tee /etc/apt/sources.list.d/llvm-${{ matrix.llvm }}.list - deb http://apt.llvm.org/${release}/ llvm-toolchain-${release}-${{ matrix.llvm }} main - deb-src http://apt.llvm.org/${release}/ llvm-toolchain-${release}-${{ matrix.llvm }} main + cat << EOF | sudo tee /etc/apt/sources.list.d/llvm${llvm_suffix}.list + deb http://apt.llvm.org/${release}/ llvm-toolchain-${release}${llvm_suffix} main + deb-src http://apt.llvm.org/${release}/ llvm-toolchain-${release}${llvm_suffix} main EOF fi @@ -74,13 +107,18 @@ jobs: if [[ -n "$(which lldb-${{ matrix.llvm }})" ]]; then sudo ln -s "$(which lldb-${{ matrix.llvm }})" /usr/bin/lldb - sudo mkdir -p /usr/lib/lib/python3.8 - sudo ln -s /usr/lib/llvm-${{ matrix.llvm }}/lib/python3.8/site-packages /usr/lib/lib/python3.8/site-packages + python_version="$(python3 --version 2>&1 | cut -d' ' -f2 | cut -d'.' -f3 --complement)"; + # Is `/usr/lib/lib` here correct? + sudo mkdir -p /usr/lib/lib/python${python_version} + sudo ln -s /usr/lib/llvm-${{ matrix.llvm }}/lib/python${python_version}/site-packages /usr/lib/lib/python${python_version}/site-packages fi if [[ -n "$(which llvm-config-${{ matrix.llvm }})" ]]; then sudo ln -s "$(which llvm-config-${{ matrix.llvm }})" /usr/bin/llvm-config fi + + echo "/usr/lib/llvm-${{ matrix.llvm }}/lib" | sudo tee /etc/ld.so.conf.d/llvm.conf + sudo ldconfig - name: npm install run: | npm install --llnode_build_addon=true --llnode_coverage=true @@ -112,7 +150,7 @@ jobs: - name: npm install, build, and test run: | sudo apt-get -qq update - sudo apt-get install lldb-6.0 liblldb-6.0-dev lcov -y - sudo ln -s $(which lldb-6.0) /usr/bin/lldb + sudo apt-get install lldb-11 liblldb-11-dev lcov -y + sudo ln -s $(which lldb-11) /usr/bin/lldb npm install npm run linter diff --git a/scripts/linux.js b/scripts/linux.js index d58fa468..7b49f676 100644 --- a/scripts/linux.js +++ b/scripts/linux.js @@ -23,9 +23,9 @@ function getLldbExecutable() { // Use `Array.prototype.concat.apply` to support // runtimes without `Array.prototype.flatMap`. - // Look for LLDB up to version 20. + // Look for LLDB up to version 99. const versions = Array.prototype.concat.apply([], - Array.from({length: 20}, (_, i) => i + 1).map((major) => + Array.from({length: 99}, (_, i) => i + 1).map((major) => Array.from({ length: major < 4 ? 10 : 1 }, (_, minor) => major + '.' + minor) )); diff --git a/scripts/lldb.js b/scripts/lldb.js index b9630835..a29fbf4e 100644 --- a/scripts/lldb.js +++ b/scripts/lldb.js @@ -26,7 +26,33 @@ function versionToBranch(version) { chars = chars.slice(0, (+chars[0] >= 4) ? 1 : 2); // join components into the form `release/3.9.x` - return 'release/' + chars.concat('x').join('.'); + const releaseBranch = 'release/' + chars.concat('x').join('.'); + + // Use the release branch if it exists in the remote + if (0 === child_process.spawnSync('git', [ + 'ls-remote', + '--exit-code', + '--heads', + 'https://github.com/llvm/llvm-project.git', + 'refs/heads/' + releaseBranch + ]).status) { + return releaseBranch; + } + + const devTag = 'llvmorg-' + chars.join('.') + '-init'; + + // Use the main branch if the LLVM version is the current "dev" release + if (0 === child_process.spawnSync('git', [ + 'ls-remote', + '--exit-code', + '--tags', + 'https://github.com/llvm/llvm-project.git', + 'refs/tags/' + devTag + ]).status) { + return 'main'; + } + + throw new Error('Unknown LLVM version: ' + version); } /**