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

Fix Android CI #354

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/run-ci-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
VERIFY: ${{ inputs.verify }}
FEATURES: ${{ inputs.features }}
- name: Run CI Script
timeout-minutes: 30
timeout-minutes: 60
run: ${{ inputs.script }}
env:
TARGET: ${{ inputs.target }}
Expand Down
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ build = "build.rs"
edition = "2018"

[badges]
appveyor = { repository = "rust-lang/packed_simd" }
travis-ci = { repository = "rust-lang/packed_simd" }
codecov = { repository = "rust-lang/packed_simd" }
is-it-maintained-issue-resolution = { repository = "rust-lang/packed_simd" }
is-it-maintained-open-issues = { repository = "rust-lang/packed_simd" }
Expand Down
31 changes: 21 additions & 10 deletions ci/android-install-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ set -ex
# located in https://github.com/appunite/docker by just wrapping it in a script
# which apparently magically accepts the licenses.

ANDROID_SDK_URL=https://dl.google.com/android/repository
ANDROID_SDK_ARCHIVE=commandlinetools-linux-9477386_latest.zip

mkdir sdk
curl --retry 5 https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O
unzip -d sdk sdk-tools-linux-3859397.zip
curl --retry 5 "$ANDROID_SDK_URL/$ANDROID_SDK_ARCHIVE" -O
unzip -d sdk "$ANDROID_SDK_ARCHIVE"

case "$1" in
arm | armv7)
abi=armeabi-v7a
version="android-24"
abi="armeabi-v7a"
;;

aarch64)
abi=arm64-v8a
version="android-31"
abi="arm64-v8a"
;;

i686)
Expand All @@ -45,16 +50,22 @@ case "$1" in
;;
esac;

mv sdk/cmdline-tools latest
mkdir sdk/cmdline-tools
mv latest sdk/cmdline-tools

ANDROID_SDK_BIN="./sdk/cmdline-tools/latest/bin"

# --no_https avoids
# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
yes | ./sdk/tools/bin/sdkmanager --licenses --no_https
yes | ./sdk/tools/bin/sdkmanager --no_https \
yes | "$ANDROID_SDK_BIN/sdkmanager" --licenses --no_https
yes | "$ANDROID_SDK_BIN/sdkmanager" --no_https \
"emulator" \
"platform-tools" \
"platforms;android-24" \
"system-images;android-24;default;$abi"
"platforms;$version" \
"system-images;$version;default;$abi"

echo "no" |
./sdk/tools/bin/avdmanager create avd \
"$ANDROID_SDK_BIN/avdmanager" create avd \
--name "${1}" \
--package "system-images;android-24;default;$abi"
--package "system-images;$version;default;$abi"
18 changes: 10 additions & 8 deletions ci/docker/aarch64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:16.04
FROM ubuntu:22.04

RUN dpkg --add-architecture i386 && \
apt-get update && \
Expand All @@ -7,10 +7,10 @@ RUN dpkg --add-architecture i386 && \
make \
curl \
ca-certificates \
python \
python-is-python3 \
unzip \
expect \
openjdk-9-jre \
openjdk-11-jre \
libstdc++6:i386 \
libpulse0 \
gcc \
Expand All @@ -20,16 +20,18 @@ WORKDIR /android/
COPY android* /android/

ENV ANDROID_ARCH=aarch64
ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools

RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
RUN sh /android/android-install-ndk.sh
ENV PATH=$PATH:/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
ENV PATH=$PATH:/android/sdk/cmdline-tools:/android/sdk/platform-tools

RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
RUN chmod 755 /android/sdk/*tools/**/* /android/sdk/emulator/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android21-clang \
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \
OBJDUMP=aarch64-linux-android-objdump \
HOME=/tmp
Expand All @@ -41,7 +43,7 @@ ENTRYPOINT [ \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @aarch64 -no-window & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
rustc /tmp/runtest.rs -O -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
2 changes: 1 addition & 1 deletion ci/docker/aarch64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
ca-certificates \
Expand Down
22 changes: 12 additions & 10 deletions ci/docker/armv7-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:16.04
FROM ubuntu:22.04

RUN dpkg --add-architecture i386 && \
apt-get update && \
Expand All @@ -7,10 +7,10 @@ RUN dpkg --add-architecture i386 && \
make \
curl \
ca-certificates \
python \
python-is-python3 \
unzip \
expect \
openjdk-9-jre \
openjdk-11-jre \
libstdc++6:i386 \
libpulse0 \
gcc \
Expand All @@ -20,18 +20,20 @@ WORKDIR /android/
COPY android* /android/

ENV ANDROID_ARCH=arm
ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools

RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
RUN sh /android/android-install-ndk.sh
ENV PATH=$PATH:/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
ENV PATH=$PATH:/android/sdk/cmdline-tools:/android/sdk/platform-tools

RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
RUN chmod 755 /android/sdk/*tools/**/* /android/sdk/emulator/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
OBJDUMP=arm-linux-androideabi-objdump \
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi19-clang \
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
OBJDUMP=llvm-objdump \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
Expand All @@ -41,7 +43,7 @@ ENTRYPOINT [ \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @arm -no-window & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
rustc /tmp/runtest.rs -O -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
19 changes: 11 additions & 8 deletions ci/docker/thumbv7neon-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:16.04
FROM ubuntu:22.04

RUN dpkg --add-architecture i386 && \
apt-get update && \
Expand All @@ -7,10 +7,10 @@ RUN dpkg --add-architecture i386 && \
make \
curl \
ca-certificates \
python \
python-is-python3 \
unzip \
expect \
openjdk-9-jre \
openjdk-11-jre \
libstdc++6:i386 \
libpulse0 \
gcc \
Expand All @@ -20,16 +20,19 @@ WORKDIR /android/
COPY android* /android/

ENV ANDROID_ARCH=arm
ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools

RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
RUN sh /android/android-install-ndk.sh
ENV PATH=$PATH:/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin

RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
ENV PATH=$PATH:/android/sdk/cmdline-tools:/android/sdk/platform-tools

RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
RUN chmod 755 /android/sdk/*tools/**/* /android/sdk/emulator/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_THUMBV7NEON_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
CARGO_TARGET_THUMBV7NEON_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi19-clang \
CARGO_TARGET_THUMBV7NEON_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
OBJDUMP=arm-linux-androideabi-objdump \
HOME=/tmp
Expand All @@ -41,7 +44,7 @@ ENTRYPOINT [ \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @arm -no-window & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
rustc /tmp/runtest.rs -O -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
15 changes: 12 additions & 3 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,18 @@ cargo_test_impl() {
RUSTFLAGS=${ORIGINAL_RUSTFLAGS}
}

# Debug run:
if [[ "${TARGET}" != "wasm32-unknown-unknown" ]]; then
# Run wasm32-unknown-unknown in release mode only
release_only=false
if [[ "${TARGET}" =~ wasm32 ]]; then
release_only=true
elif [[ "${TARGET}" =~ aarch64 ]]; then
release_only=true
elif [[ "${TARGET}" =~ androideabi ]]; then
release_only=true
fi

if [[ "$release_only" == false ]]; then
# Run wasm32-unknown-unknown, aarch64, and android in release mode only
# as for some reason the emulation quality of these is low
cargo_test_impl
fi

Expand Down
Loading