1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

fix(ci): restore compatibility with older glibc (#13846)

Fixes: #13516
This commit is contained in:
Bert Belder 2022-03-07 18:07:10 -08:00 committed by GitHub
parent e53b6c16bc
commit 566a1493f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,7 +149,7 @@ jobs:
- name: Error on warning - name: Error on warning
# TODO(piscisaureus): enable this on Windows again. # TODO(piscisaureus): enable this on Windows again.
if: "!matrix.use_sysroot && !startsWith(matrix.os, 'windows')" if: "!startsWith(matrix.os, 'windows')"
run: echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV run: echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV
- name: Configure canary build - name: Configure canary build
@ -161,86 +161,67 @@ jobs:
shell: bash shell: bash
run: echo "DENO_CANARY=true" >> $GITHUB_ENV run: echo "DENO_CANARY=true" >> $GITHUB_ENV
- name: Set up Linux sysroot with Ubuntu 18.04 and LLVM - name: Set up incremental LTO and sysroot build
if: matrix.use_sysroot if: matrix.use_sysroot
run: | run: |
# Avoid running man-db triggers, which sometimes takes several minutes # Avoid running man-db triggers, which sometimes takes several minutes
# to complete. # to complete.
sudo apt-get remove --purge -y man-db sudo apt-get remove --purge -y man-db
sudo apt-get update
sudo apt-get install debootstrap
# Install clang-13, lld-13, and debootstrap.
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" |
sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-focal-13.list
curl https://apt.llvm.org/llvm-snapshot.gpg.key |
gpg --dearmor |
sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
sudo apt-get update
sudo apt-get install --no-install-recommends debootstrap \
clang-13 lld-13
# Create ubuntu-16.04 sysroot environment, which is used to avoid
# depending on a very recent version of glibc.
# `libc6-dev` is required for building any C source files.
# `file` and `make` are needed to build libffi-sys. # `file` and `make` are needed to build libffi-sys.
# `curl` is needed to build rusty_v8. # `curl` is needed to build rusty_v8.
# `git`, `nc`, `strace`, and `time`, are needed to run the benchmarks. sudo debootstrap \
sudo debootstrap \ --include=ca-certificates,curl,file,libc6-dev,make \
--include=ca-certificates,curl,file,git,make,netcat-openbsd,strace,time \ --no-merged-usr --variant=minbase xenial /sysroot \
--no-merged-usr --variant=minbase bionic /sysroot \
http://azure.archive.ubuntu.com/ubuntu http://azure.archive.ubuntu.com/ubuntu
sudo mount --rbind /dev /sysroot/dev sudo mount --rbind /dev /sysroot/dev
sudo mount --rbind /sys /sysroot/sys sudo mount --rbind /sys /sysroot/sys
sudo mount --rbind /home /sysroot/home sudo mount --rbind /home /sysroot/home
sudo mount -t proc /proc /sysroot/proc sudo mount -t proc /proc /sysroot/proc
sudo ln --force --target /sysroot/etc \ # Configure the build environment. Both Rust and Clang will produce
/etc/passwd /etc/shadow /etc/group /etc/gshadow # llvm bitcode only, so we can use lld's incremental LTO support.
cat >> $GITHUB_ENV << __0
# Install clang-13 and lld-13 into the chroot environment. CARGO_PROFILE_BENCH_INCREMENTAL=false
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main" | CARGO_PROFILE_BENCH_LTO=false
sudo dd of=/sysroot/etc/apt/sources.list.d/llvm-toolchain-bionic-13.list CARGO_PROFILE_RELEASE_INCREMENTAL=false
curl https://apt.llvm.org/llvm-snapshot.gpg.key | CARGO_PROFILE_RELEASE_LTO=false
gpg --dearmor | RUSTFLAGS<<__1
sudo dd of=/sysroot/etc/apt/trusted.gpg.d/llvm-snapshot.gpg -C linker-plugin-lto=true
sudo chroot /sysroot apt-get update -C linker=clang-13
sudo chroot /sysroot apt-get install --no-install-recommends -y \ -C link-arg=-fuse-ld=lld-13
clang-13 lld-13 -C link-arg=--sysroot=/sysroot
-C link-arg=-Wl,--allow-shlib-undefined
# Redirect ld invocations to ld.lld-13 inside the chroot environment. -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
# Setting the 'LD' environment variable doesn't always work. -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
sudo chroot /sysroot bash -c \ ${{ env.RUSTFLAGS }}
'ln -f "$(which ld.lld-13)" "$(which ld)"' __1
RUSTDOCFLAGS<<__1
# Make node (needed to run the benchmarks) available. -C linker-plugin-lto=true
sudo ln --target /sysroot/usr/bin "$(which node)" -C linker=clang-13
-C link-arg=-fuse-ld=lld-13
cat >> ~/.bash_profile << ___ -C link-arg=--sysroot=/sysroot
cd "$(pwd)" -C link-arg=-Wl,--allow-shlib-undefined
-C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
# Configure canary build. -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
if [ "$DENO_CANARY" == "true" ] ${{ env.RUSTFLAGS }}
then __1
export DENO_CANARY=true CC=clang-13
fi CFLAGS=-flto=thin --sysroot=/sysroot
__0
# Add cargo, rustc, and deno to $PATH.
source /home/runner/.cargo/env
export PATH="$PATH:$(pwd)/target/release"
# Rust build configuration.
export CARGO_PROFILE_BENCH_INCREMENTAL=false
export CARGO_PROFILE_BENCH_LTO=false
export CARGO_PROFILE_RELEASE_INCREMENTAL=false
export CARGO_PROFILE_RELEASE_LTO=false
export RUSTFLAGS="
-C linker-plugin-lto=true
-C linker=clang-13
-C link-arg=-fuse-ld=lld-13
-C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
-C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
-D warnings
"
export RUSTDOCFLAGS="\$RUSTFLAGS"
unset RUSTC_FORCE_INCREMENTAL
# C build configuration.
export CC=clang-13 # Compile c source files with clang.
export CFLAGS=-flto=thin # Tell clang to produce llvm bitcode.
export LD=ld.lld-13 # Use the lld linker.
# Miscellaneous flags.
export CARGO_TERM_COLOR=always
export CI=true
___
- name: Log versions - name: Log versions
shell: bash shell: bash
@ -337,7 +318,7 @@ jobs:
- name: Build debug - name: Build debug
if: | if: |
(matrix.job == 'test' || matrix.job == 'bench') && (matrix.job == 'test' || matrix.job == 'bench') &&
matrix.profile == 'debug' && !matrix.use_sysroot matrix.profile == 'debug'
run: cargo build --locked --all-targets run: cargo build --locked --all-targets
- name: Build fastci - name: Build fastci
@ -349,25 +330,18 @@ jobs:
- name: Build release - name: Build release
if: | if: |
(matrix.job == 'test' || matrix.job == 'bench') && (matrix.job == 'test' || matrix.job == 'bench') &&
matrix.profile == 'release' && !matrix.use_sysroot && matrix.profile == 'release' && (matrix.use_sysroot ||
github.repository == 'denoland/deno' && (github.repository == 'denoland/deno' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) (github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/tags/'))))
run: cargo build --release --locked --all-targets run: cargo build --release --locked --all-targets
- name: Build release (in sysroot)
if: |
(matrix.job == 'test' || matrix.job == 'bench') &&
matrix.profile == 'release' && matrix.use_sysroot
run: |
sudo chroot /sysroot \
su -l "$(whoami)" \
-c "cargo build --release --locked --all-targets"
- name: Pre-release (linux) - name: Pre-release (linux)
if: | if: |
startsWith(matrix.os, 'ubuntu') && startsWith(matrix.os, 'ubuntu') &&
matrix.job == 'test' && matrix.job == 'test' &&
matrix.profile == 'release' matrix.profile == 'release' &&
github.repository == 'denoland/deno'
run: | run: |
cd target/release cd target/release
zip -r deno-x86_64-unknown-linux-gnu.zip deno zip -r deno-x86_64-unknown-linux-gnu.zip deno
@ -420,7 +394,7 @@ jobs:
- name: Test debug - name: Test debug
if: | if: |
matrix.job == 'test' && matrix.profile == 'debug' && matrix.job == 'test' && matrix.profile == 'debug' &&
!matrix.use_sysroot && !startsWith(github.ref, 'refs/tags/') !startsWith(github.ref, 'refs/tags/')
run: | run: |
cargo test --locked --doc cargo test --locked --doc
cargo test --locked cargo test --locked
@ -434,29 +408,25 @@ jobs:
- name: Test release - name: Test release
if: | if: |
matrix.job == 'test' && matrix.profile == 'release' && matrix.job == 'test' && matrix.profile == 'release' &&
!matrix.use_sysroot && (matrix.use_sysroot || (
github.repository == 'denoland/deno' && github.repository == 'denoland/deno' &&
github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')))
run: cargo test --release --locked run: cargo test --release --locked
- name: Test release (in sysroot)
if: |
matrix.job == 'test' && matrix.profile == 'release' &&
matrix.use_sysroot && !startsWith(github.ref, 'refs/tags/')
run: |
sudo chroot /sysroot \
su -l "$(whoami)" \
-c "cargo test --release --locked"
# Since all tests are skipped when we're building a tagged commit # Since all tests are skipped when we're building a tagged commit
# this is a minimal check to ensure that binary is not corrupted # this is a minimal check to ensure that binary is not corrupted
- name: Check Deno Binary - name: Check deno binary
if: matrix.profile == 'release' && startsWith(github.ref, 'refs/tags/') if: matrix.profile == 'release' && startsWith(github.ref, 'refs/tags/')
shell: bash shell: bash
run: target/release/deno eval "console.log(1+2)" | grep 3 run: target/release/deno eval "console.log(1+2)" | grep 3
env: env:
NO_COLOR: 1 NO_COLOR: 1
# Verify that the binary actually works in the Ubuntu-16.04 sysroot.
- name: Check deno binary (in sysroot)
if: matrix.use_sysroot
run: sudo chroot /sysroot "$(pwd)/target/release/deno" --version
# TODO(ry): Because CI is so slow on for OSX and Windows, we currently # TODO(ry): Because CI is so slow on for OSX and Windows, we currently
# run the Web Platform tests only on Linux. # run the Web Platform tests only on Linux.
- name: Configure hosts file for WPT - name: Configure hosts file for WPT
@ -526,16 +496,9 @@ jobs:
./tools/upload_wptfyi.js $(git rev-parse HEAD) --ghstatus ./tools/upload_wptfyi.js $(git rev-parse HEAD) --ghstatus
- name: Run benchmarks - name: Run benchmarks
if: matrix.job == 'bench' && !matrix.use_sysroot && !startsWith(github.ref, 'refs/tags/') if: matrix.job == 'bench' && !startsWith(github.ref, 'refs/tags/')
run: cargo bench --locked run: cargo bench --locked
- name: Run benchmarks (in sysroot)
if: matrix.job == 'bench' && matrix.use_sysroot
run: |
sudo chroot /sysroot \
su -l "$(whoami)" \
-c "cargo bench --locked"
- name: Post Benchmarks - name: Post Benchmarks
if: | if: |
matrix.job == 'bench' && matrix.job == 'bench' &&