Added WASI support to mozjs (WIP) #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
workflow_dispatch: | |
merge_group: | |
types: [checks_requested] | |
env: | |
RUST_BACKTRACE: 1 | |
SHELL: /bin/bash | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
mac: | |
runs-on: macos-13 | |
strategy: | |
fail-fast: false | |
matrix: | |
features: ["--features debugmozjs", ""] | |
env: | |
RUSTC_WRAPPER: sccache | |
CCACHE: sccache | |
SCCACHE_GHA_ENABLED: "true" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install deps | |
run: brew install python llvm yasm | |
- name: Run sccache-cache | |
uses: mozilla-actions/sccache-action@v0.0.3 | |
- name: Build | |
run: | | |
cargo build --verbose ${{ matrix.features }} | |
cargo test --verbose ${{ matrix.features }} | |
linux: | |
env: | |
RUSTC_WRAPPER: "sccache" | |
CCACHE: sccache | |
SCCACHE_GHA_ENABLED: "true" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
features: ["--features debugmozjs", ""] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install deps | |
run: | | |
sudo apt install llvm -y | |
- name: Run sccache-cache | |
uses: mozilla-actions/sccache-action@v0.0.3 | |
- name: Build | |
run: | | |
cargo build --verbose ${{ matrix.features }} | |
cargo test --verbose ${{ matrix.features }} | |
windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
features: ["--features debugmozjs", ""] | |
target: ["x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"] | |
env: | |
LINKER: "lld-link.exe" | |
CC: "clang-cl" | |
CXX: "clang-cl" | |
MOZTOOLS_PATH: "${{ github.workspace }}\\target\\dependencies\\moztools-4.0" | |
CCACHE: sccache | |
SCCACHE_GHA_ENABLED: "true" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Install deps | |
run: | | |
curl -SL "https://github.com/servo/servo-build-deps/releases/download/msvc-deps/moztools-4.0.zip" --create-dirs -o target/dependencies/moztools.zip | |
cd target/dependencies && unzip -qo moztools.zip -d . | |
- name: Run sccache-cache | |
uses: mozilla-actions/sccache-action@v0.0.3 | |
- name: Build Windows | |
shell: cmd | |
run: | | |
cargo build --verbose --target ${{ matrix.target }} ${{ matrix.features }} | |
- name: Test Windows | |
if: ${{ !contains(matrix.target, 'aarch64') }} | |
shell: cmd | |
run: | | |
cargo test --verbose --target ${{ matrix.target }} ${{ matrix.features }} | |
android: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install NDK | |
uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r25c | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: armv7-linux-androideabi | |
- name: Build | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
run: | | |
./android-build cargo build --target="armv7-linux-androideabi" | |
linux-cross-compile: | |
name: linux (${{ matrix.target }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- aarch64-unknown-linux-gnu | |
- armv7-unknown-linux-gnueabihf | |
container: ghcr.io/servo/cross-${{ matrix.target }}:main | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- run: cargo test --target ${{ matrix.target }} | |
integrity: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get mozjs | |
run: | | |
bash ./mozjs-sys/etc/get_mozjs.sh | |
- name: Apply patch | |
run: | | |
python3 ./mozjs-sys/etc/update.py --no-commit mozjs.tar.xz | |
# Run `git add` here to force CRLF converted into LF | |
# so that we can check diff properly in next run | |
git add --all mozjs | |
- name: Check patch integrity | |
working-directory: ./mozjs-sys | |
# Because we've added files in previous run, we need to | |
# check diff with `--staged`. | |
run: | | |
git diff --staged --no-ext-diff --quiet --exit-code | |
build_result: | |
name: Result | |
runs-on: ubuntu-latest | |
needs: | |
["android", "linux", "linux-cross-compile", "mac", "windows", "integrity"] | |
if: ${{ always() }} | |
steps: | |
- name: Mark the job as successful | |
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | |
run: exit 0 | |
- name: Mark the job as unsuccessful | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | |
run: exit 1 |