summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml165
1 files changed, 64 insertions, 101 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index db75c1baa..c635156aa 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -149,7 +149,7 @@ jobs:
- name: Error on warning
# 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
- name: Configure canary build
@@ -161,86 +161,67 @@ jobs:
shell: bash
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
run: |
# Avoid running man-db triggers, which sometimes takes several minutes
# to complete.
sudo apt-get remove --purge -y man-db
+
+ # 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 debootstrap
+ 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.
# `curl` is needed to build rusty_v8.
- # `git`, `nc`, `strace`, and `time`, are needed to run the benchmarks.
- sudo debootstrap \
- --include=ca-certificates,curl,file,git,make,netcat-openbsd,strace,time \
- --no-merged-usr --variant=minbase bionic /sysroot \
+ sudo debootstrap \
+ --include=ca-certificates,curl,file,libc6-dev,make \
+ --no-merged-usr --variant=minbase xenial /sysroot \
http://azure.archive.ubuntu.com/ubuntu
sudo mount --rbind /dev /sysroot/dev
sudo mount --rbind /sys /sysroot/sys
sudo mount --rbind /home /sysroot/home
sudo mount -t proc /proc /sysroot/proc
- sudo ln --force --target /sysroot/etc \
- /etc/passwd /etc/shadow /etc/group /etc/gshadow
-
- # Install clang-13 and lld-13 into the chroot environment.
- echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main" |
- sudo dd of=/sysroot/etc/apt/sources.list.d/llvm-toolchain-bionic-13.list
- curl https://apt.llvm.org/llvm-snapshot.gpg.key |
- gpg --dearmor |
- sudo dd of=/sysroot/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
- sudo chroot /sysroot apt-get update
- sudo chroot /sysroot apt-get install --no-install-recommends -y \
- clang-13 lld-13
-
- # Redirect ld invocations to ld.lld-13 inside the chroot environment.
- # Setting the 'LD' environment variable doesn't always work.
- sudo chroot /sysroot bash -c \
- 'ln -f "$(which ld.lld-13)" "$(which ld)"'
-
- # Make node (needed to run the benchmarks) available.
- sudo ln --target /sysroot/usr/bin "$(which node)"
-
- cat >> ~/.bash_profile << ___
- cd "$(pwd)"
-
- # Configure canary build.
- if [ "$DENO_CANARY" == "true" ]
- then
- export DENO_CANARY=true
- fi
-
- # 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
- ___
+ # Configure the build environment. Both Rust and Clang will produce
+ # llvm bitcode only, so we can use lld's incremental LTO support.
+ cat >> $GITHUB_ENV << __0
+ CARGO_PROFILE_BENCH_INCREMENTAL=false
+ CARGO_PROFILE_BENCH_LTO=false
+ CARGO_PROFILE_RELEASE_INCREMENTAL=false
+ CARGO_PROFILE_RELEASE_LTO=false
+ RUSTFLAGS<<__1
+ -C linker-plugin-lto=true
+ -C linker=clang-13
+ -C link-arg=-fuse-ld=lld-13
+ -C link-arg=--sysroot=/sysroot
+ -C link-arg=-Wl,--allow-shlib-undefined
+ -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
+ -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
+ ${{ env.RUSTFLAGS }}
+ __1
+ RUSTDOCFLAGS<<__1
+ -C linker-plugin-lto=true
+ -C linker=clang-13
+ -C link-arg=-fuse-ld=lld-13
+ -C link-arg=--sysroot=/sysroot
+ -C link-arg=-Wl,--allow-shlib-undefined
+ -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
+ -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
+ ${{ env.RUSTFLAGS }}
+ __1
+ CC=clang-13
+ CFLAGS=-flto=thin --sysroot=/sysroot
+ __0
- name: Log versions
shell: bash
@@ -337,7 +318,7 @@ jobs:
- name: Build debug
if: |
(matrix.job == 'test' || matrix.job == 'bench') &&
- matrix.profile == 'debug' && !matrix.use_sysroot
+ matrix.profile == 'debug'
run: cargo build --locked --all-targets
- name: Build fastci
@@ -349,25 +330,18 @@ jobs:
- name: Build release
if: |
(matrix.job == 'test' || matrix.job == 'bench') &&
- matrix.profile == 'release' && !matrix.use_sysroot &&
- github.repository == 'denoland/deno' &&
- (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
+ matrix.profile == 'release' && (matrix.use_sysroot ||
+ (github.repository == 'denoland/deno' &&
+ (github.ref == 'refs/heads/main' ||
+ startsWith(github.ref, 'refs/tags/'))))
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)
if: |
startsWith(matrix.os, 'ubuntu') &&
matrix.job == 'test' &&
- matrix.profile == 'release'
+ matrix.profile == 'release' &&
+ github.repository == 'denoland/deno'
run: |
cd target/release
zip -r deno-x86_64-unknown-linux-gnu.zip deno
@@ -420,7 +394,7 @@ jobs:
- name: Test debug
if: |
matrix.job == 'test' && matrix.profile == 'debug' &&
- !matrix.use_sysroot && !startsWith(github.ref, 'refs/tags/')
+ !startsWith(github.ref, 'refs/tags/')
run: |
cargo test --locked --doc
cargo test --locked
@@ -434,29 +408,25 @@ jobs:
- name: Test release
if: |
matrix.job == 'test' && matrix.profile == 'release' &&
- !matrix.use_sysroot &&
+ (matrix.use_sysroot || (
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
- - 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
# 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/')
shell: bash
run: target/release/deno eval "console.log(1+2)" | grep 3
env:
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
# run the Web Platform tests only on Linux.
- name: Configure hosts file for WPT
@@ -526,16 +496,9 @@ jobs:
./tools/upload_wptfyi.js $(git rev-parse HEAD) --ghstatus
- 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
- - 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
if: |
matrix.job == 'bench' &&