Add support for Android NDK r21 #444
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: | |
pull_request: | |
merge_group: | |
types: [checks_requested] | |
env: | |
RUST_BACKTRACE: 1 | |
SHELL: /bin/bash | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
mac: | |
# Run CI only on master in upstream | |
if: ${{ !(github.repository == 'servo/mozjs' && github.event_name == 'push') || github.ref_name == 'master' }} | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
features: ["--features debugmozjs", ""] | |
env: | |
RUSTC_WRAPPER: sccache | |
CCACHE: sccache | |
SCCACHE_GHA_ENABLED: "true" | |
SCCACHE_VERSION: "v0.4.0" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install deps | |
run: brew install python [email protected] llvm yasm | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
with: | |
version: ${{ env.SCCACHE_VERSION }} | |
- name: Build | |
run: | | |
cargo build --verbose ${{ matrix.features }} | |
cargo test --verbose ${{ matrix.features }} | |
linux: | |
# Run CI only on master in upstream | |
if: ${{ !(github.repository == 'servo/mozjs' && github.event_name == 'push') || github.ref_name == 'master' }} | |
env: | |
RUSTC_WRAPPER: "sccache" | |
CCACHE: sccache | |
SCCACHE_GHA_ENABLED: "true" | |
SCCACHE_VERSION: "v0.4.0" | |
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 autoconf2.13 llvm -y | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
with: | |
version: ${{ env.SCCACHE_VERSION }} | |
- name: Build | |
run: | | |
cargo build --verbose ${{ matrix.features }} | |
cargo test --verbose ${{ matrix.features }} | |
windows: | |
# Run CI only on master in upstream | |
if: ${{ !(github.repository == 'servo/mozjs' && github.event_name == 'push') || github.ref_name == 'master' }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
features: ["--features debugmozjs", ""] | |
#target: [""] | |
target: ["", "aarch64-uwp-windows-msvc", "x86_64-uwp-windows-msvc"] | |
env: | |
MOZILLA_BUILD: 'C:\mozilla-build' | |
LINKER: "lld-link.exe" | |
CC: "clang-cl" | |
CXX: "clang-cl" | |
PYTHON3: "C:\\mozilla-build\\python3\\python3.exe" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
if: (!contains(matrix.target, 'uwp')) | |
- uses: dtolnay/rust-toolchain@master | |
if: contains(matrix.target, 'uwp') | |
with: | |
toolchain: "nightly-2023-02-02" | |
components: rust-src | |
- name: Install deps | |
run: | | |
Start-BitsTransfer -Source https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-3.4.exe -Destination ./MozillaBuildSetup.exe | |
.\MozillaBuildSetup.exe /S | Out-Null | |
echo 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Tools\LLVM\bin' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
with: | |
version: ${{ env.SCCACHE_VERSION }} | |
- name: Build uwp | |
if: contains(matrix.target, 'uwp') | |
shell: cmd | |
run: | | |
rustc --version --verbose | |
cargo build --verbose ${{ matrix.features }} -Z build-std=std,panic_abort --target ${{ matrix.target }} | |
- name: Build Windows | |
if: contains(matrix.target, 'uwp') != true | |
shell: cmd | |
run: | | |
cargo test --verbose ${{ 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: r21d | |
- 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" | |
# The integrity check is currently broken. See issue #345. | |
# | |
# Integrity: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Get mozjs | |
# run: | | |
# bash ./mozjs/etc/get_mozjs.sh | |
# - name: Apply patch | |
# run: | | |
# python3 ./mozjs/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 | |
# # 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 | |
# Integrity check is broken for the time being; don't require it. | |
needs: ["mac", "linux", "windows"] | |
steps: | |
- name: Mark the job as successful | |
run: exit 0 | |
if: success() | |
- name: Mark the job as unsuccessful | |
run: exit 1 | |
if: "!success()" |