Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Musl docker #1650

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ jobs:
key:
cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }}
restore-keys:
cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}-
cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}-1

- name: Install and start sccache
shell: pwsh
Expand Down Expand Up @@ -193,6 +193,12 @@ jobs:
curl -O http://commondatastorage.googleapis.com/chromium-browser-clang-staging/Mac/dsymutil-llvmorg-17-init-19076-g5533fc10-1.tgz
tar -C tools/clang/dsymutil/ -xvzf dsymutil-llvmorg-17-init-19076-g5533fc10-1.tgz
V8_FROM_SOURCE=true RUSTFLAGS="-C opt-level=1 -Zsanitizer=address" cargo +nightly -Z build-std test --lib --bins --tests -vv --target ${{ matrix.config.target }}
- name: Build Musl
if: matrix.config.target == 'x86_64-unknown-linux-gnu'
run: |
docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh ${{ env.CARGO_VARIANT_FLAG }}
docker cp $(docker ps -lq):/usr/src/rusty_v8/target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a
sudo chown $(id -u):$(id -g) /home/runner/work/rusty_v8/rusty_v8/target/debug/

- name: Test
env:
Expand All @@ -207,6 +213,9 @@ jobs:
${{ matrix.config.cargo }} clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
--target ${{ matrix.config.target }} -- -D clippy::all

- name: Rustfmt
run: cargo fmt -- --check

- name: Prepare binary publish
if: matrix.config.variant == 'debug' || matrix.config.variant == 'release'
run: |
Expand Down
35 changes: 35 additions & 0 deletions musl-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

apk add git \
gcc \
ninja \
python3 \
clang \
g++ \
pkgconfig \
glib-dev \
llvm13-dev \
binutils-gold \
sccache
ln -s /usr/bin/python3 /usr/bin/python

export V8_FROM_SOURCE="yes"
export CLANG_BASE_PATH="/usr"
export SCCACHE_DIR="./target/sccache"
export SCCACHE="/usr/bin/sccache"
export GN_ARGS="use_custom_libcxx=false use_lld=false v8_enable_backtrace=false v8_enable_debugging_features=false"
GN="$(pwd)/gn/out/gn"
export GN

# Bulid GN
if [ ! -d "./gn" ]; then
git clone https://gn.googlesource.com/gn
(
cd gn || exit
python3 build/gen.py
ninja -C out
)
fi

# Build rusty_v8 and pass through the arguments
cargo build -vv $@ --target=x86_64-unknown-linux-musl
Loading