Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/actions/binary-compatible-builds/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ runs:
- if: runner.os == 'Linux'
shell: bash
run: |
# FIXME(rust-lang/rust#80703) LD_LIBRARY_PATH shouldn't be necessary
docker run -di --name centos -v $PWD:$PWD -v $(rustc --print sysroot):/rust:ro \
--env LD_LIBRARY_PATH=/rust/lib \
--env PATH="/opt/rh/devtoolset-8/root/usr/bin:$PATH:/rust/bin" \
binary-compatible-builds

cat >> $GITHUB_ENV <<EOF
CENTOS=$GITHUB_ACTION_PATH/run-linux
python=python3
Expand Down
9 changes: 7 additions & 2 deletions .github/actions/binary-compatible-builds/run-linux
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/bin/sh
#!/usr/bin/env bash

exec docker exec --env PREBUILT_ENGINE=${PREBUILT_ENGINE:-} -w $PWD -i centos "$@"
set -euo pipefail
exec docker run -i \
--env PREBUILT_ENGINE=$PREBUILT_ENGINE \
--env PATH="/opt/rh/devtoolset-8/root/usr/bin:$PATH" \
-v $HOME:$HOME --workdir $PWD \
binary-compatible-builds "$@"
11 changes: 1 addition & 10 deletions .github/actions/install-rust/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@ function set_env(name, val) {
fs.appendFileSync(process.env['GITHUB_ENV'], `${name}=${val}\n`)
}

if (process.platform === 'darwin') {
child_process.execSync(`curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=none --profile=minimal`);
const bindir = `${process.env.HOME}/.cargo/bin`;
fs.appendFileSync(process.env['GITHUB_PATH'], `${bindir}\n`);
process.env.PATH = `${process.env.PATH}:${bindir}`;
}

child_process.execFileSync('rustup', ['set', 'profile', 'minimal']);
child_process.execFileSync('rustup', ['update', toolchain, '--no-self-update']);
child_process.execFileSync('rustup', ['default', toolchain]);
child_process.execFileSync('rustup', ['show']);

// Deny warnings on CI to keep our code warning-free as it lands in-tree. Don't
// do this on nightly though since there's a fair amount of warning churn there.
Expand Down
39 changes: 19 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
path: |
c-dependencies/spidermonkey/${{ matrix.profile }}
key: cache-${{ hashFiles('c-dependencies/spidermonkey/build-engine.sh') }}-${{ hashFiles('c-dependencies/spidermonkey/gecko-revision') }}-${{ hashFiles('c-dependencies/spidermonkey/object-files.list') }}-${{ matrix.profile }}
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}

- name: "Build SpiderMonkey"
if: steps.sm-cache.outputs.cache-hit != 'true'
Expand All @@ -46,12 +47,10 @@ jobs:
sudo mkdir -p /opt/wasi-sdk
sudo mv wasi-sdk-12.0/* /opt/wasi-sdk/

- name: "Install pinned Rust version and wasm32-wasi target"
- name: "Install pinned Rust version"
run: |
rustup set profile minimal
rustup update 1.57.0 --no-self-update
rustup default 1.57.0
rustup target add wasm32-wasi
cd c-dependencies/js-compute-runtime
rustup show

- name: "Install Binaryen (linux)"
run: |
Expand All @@ -60,24 +59,24 @@ jobs:
curl -sS -L "https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz" | tar xzf - &&
echo "$PWD/binaryen-version_${BINARYEN_VERSION}/bin" >> $GITHUB_PATH

- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
c-dependencies/js-compute-runtime/rusturl
key: ${{ runner.os }}-cargo-${{ hashFiles('c-dependencies/js-compute-runtime/**/Cargo.*') }}
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}

- name: "Build JS runtime (debug)"
run: |
set -x
mkdir dist
cd dist
DEBUG=1 CXX_OPT="-O1" make -f ../c-dependencies/js-compute-runtime/Makefile
rm *.{d,o}
cd ..
run: DEBUG=1 CXX_OPT="-O1" make -C c-dependencies/js-compute-runtime DESTDIR=$PWD install
if: matrix.profile == 'debug'

- name: "Build JS runtime (release)"
run: |
set -x
mkdir dist
cd dist
make -f ../c-dependencies/js-compute-runtime/Makefile
rm *.{d,o}
cd ..
run: make -C c-dependencies/js-compute-runtime DESTDIR=$PWD install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

if: matrix.profile == 'release'

- uses: actions/upload-artifact@v1
Expand Down Expand Up @@ -204,7 +203,7 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v')
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}

# Build `js-compute-runtime`
- run: PREBUILT_ENGINE=engine-release/js-compute-runtime.wasm $CENTOS cargo build --release
Expand Down
6 changes: 5 additions & 1 deletion c-dependencies/js-compute-runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SHELL:=/bin/bash
INIT_JS ?= test.js
WIZER ?= wizer
DESTDIR ?= .

CXX_OPT ?= -O2

Expand Down Expand Up @@ -29,7 +30,7 @@ CXX_FLAGS := -std=gnu++17 -Wall -Werror -Qunused-arguments -fno-sized-deallocati
DEFINES ?=
LD_FLAGS := -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,-z,nocopyreloc -Wl,-z,stack-size=1048576 -Wl,--stack-first

.PHONY: all clean compile_commands.json
.PHONY: all install clean distclean

all: js-compute-runtime.wasm

Expand Down Expand Up @@ -65,6 +66,9 @@ js-compute-runtime.wasm: $(FSM_OBJ) $(SM_OBJ) $(RUST_URL_LIB)
initialized-js-compute-runtime.wasm: js-compute-runtime.wasm $(INIT_JS)
cat $(INIT_JS) | $(WIZER) --allow-wasi --dir=. -r _start=wizer.resume -o $@ $<

install: js-compute-runtime.wasm
install -m 444 -Dt $(DESTDIR)/dist js-compute-runtime.wasm

clean:
$(RM) compile_commands.json $(FSM_OBJ)

Expand Down
5 changes: 5 additions & 0 deletions c-dependencies/js-compute-runtime/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
# we're stuck on 1.57 until we can upgrade past wasi-sdk-12
channel = "1.57.0"
targets = [ "wasm32-wasi" ]
profile = "minimal"
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
profile = "minimal"