Skip to content

Support llvm dev releases #1693

Support llvm dev releases

Support llvm dev releases #1693

Workflow file for this run

name: on push or pull_request
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node:
- version: 14.x
- version: 16.x
- version: 18.x
# These error with "Unexpected input(s) 'node-mirror' ...":
# - version: 19.x
# mirror: https://nodejs.org/download/nightly
# - version: 19.x
# mirror: https://nodejs.org/download/v8-canary
# os: [ubuntu-latest, macos-latest]
# 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, 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 }}
uses: No9/setup-node@mirror
with:
node-version: ${{ matrix.node.version }}
# TODO(mmarchini): re-enable once mirror is supported on setup-node
node-mirror: ${{ matrix.node.mirror }}
- name: install dependencies Linux
if: startsWith(matrix.os, 'ubuntu-')
run: |
use_llvm_repos=1
case "${{ matrix.os }}" in
ubuntu-18.04)
case "${{ matrix.llvm }}" in
8) use_llvm_repos=0;;
9) use_llvm_repos=0;;
10) use_llvm_repos=0;;
*) use_llvm_repos=1;;
esac
;;
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${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
sudo apt-get -qq update
sudo apt-get install -y --no-install-recommends \
lcov gdb \
lldb-${{ matrix.llvm }} \
liblldb-${{ matrix.llvm }}-dev
if [[ -n "$(which lldb-${{ matrix.llvm }})" ]]; then
sudo ln -s "$(which lldb-${{ matrix.llvm }})" /usr/bin/lldb
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
- name: run tests
run: TEST_LLDB_BINARY=`which lldb-${{ matrix.llvm }}` npm run nyc-test-all
if: matrix.node.version != '19.x'
- name: run tests (nightly)
run: TEST_LLDB_BINARY=`which lldb-${{ matrix.llvm }}` npm run nyc-test-all
if: matrix.node.version == '19.x'
continue-on-error: true
- name: prepare coverage
if: startsWith(matrix.os, 'ubuntu-') && matrix.node.version != '19.x'
run: |
npm run coverage
cat ./coverage-js.info > ./coverage.info
cat ./coverage-cc.info >> ./coverage.info
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.info
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: npm install, build, and test
run: |
sudo apt-get -qq update
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