Skip to content

Commit

Permalink
ci: fix build for Android platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jul 27, 2022
1 parent 20cafc1 commit 1ee5194
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/publish-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,36 +107,38 @@ jobs:
- host: ubuntu-latest
target: aarch64-linux-android
build: |
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
export AR="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
touch /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.9/lib/linux/aarch64/libgcc.a
chmod 777 /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.9/lib/linux/aarch64/libgcc.a
echo "INPUT(-lunwind)" > /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.9/lib/linux/aarch64/libgcc.a
export CLANG_VERSION=`ls ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang | sed 's/ *$//g'`
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CC="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CXX="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
export AR="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
export PATH="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
touch "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/aarch64/libgcc.a"
chmod 777 "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/aarch64/libgcc.a"
echo "INPUT(-lunwind)" > "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/aarch64/libgcc.a"
cargo build -p swc_cli --release --features plugin --target aarch64-linux-android
cp ./target/aarch64-linux-android/release/swc .
chmod +x ./swc
yarn build --target aarch64-linux-android
${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
- host: ubuntu-latest
target: armv7-linux-androideabi
build: |
export DISABLE_PLUGIN_E2E_TESTS=true
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
export AR="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
touch /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.9/lib/linux/arm/libgcc.a
chmod 777 /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.9/lib/linux/arm/libgcc.a
echo "INPUT(-lunwind)" > /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.9/lib/linux/arm/libgcc.a
export CLANG_VERSION=`ls ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang | sed 's/ *$//g'`
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CC="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CXX="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
export AR="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
export PATH="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
touch "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/arm/libgcc.a"
chmod 777 "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/arm/libgcc.a"
echo "INPUT(-lunwind)" > "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/arm/libgcc.a"
cargo build -p swc_cli --release --target armv7-linux-androideabi
cp ./target/armv7-linux-androideabi/release/swc .
chmod +x ./swc
yarn build --target armv7-linux-androideabi --cargo-flags='--no-default-features --features swc_v1'
${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
downloadTarget: aarch64-unknown-linux-musl
Expand Down Expand Up @@ -251,6 +253,7 @@ jobs:
- name: Cleanup useless files to speedup
run: |
rm -rf .git
rm -rf crates/swc_css_parser/tests/errors
rm -rf crates/swc_css_parser/fixture
rm -rf crates/swc_css_parser/line-comment
Expand Down

1 comment on commit 1ee5194

@github-actions
Copy link

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: 1ee5194 Previous: c80b9e1 Ratio
es/full/minify/libraries/antd 1814463195 ns/iter (± 102803045) 1718906137 ns/iter (± 48166125) 1.06
es/full/minify/libraries/d3 451697596 ns/iter (± 41511332) 419425919 ns/iter (± 15863616) 1.08
es/full/minify/libraries/echarts 1727085354 ns/iter (± 46958729) 1676337104 ns/iter (± 48691324) 1.03
es/full/minify/libraries/jquery 105291402 ns/iter (± 6257472) 107850673 ns/iter (± 10045842) 0.98
es/full/minify/libraries/lodash 134106152 ns/iter (± 7758313) 157623771 ns/iter (± 14079357) 0.85
es/full/minify/libraries/moment 61376995 ns/iter (± 1994828) 58907684 ns/iter (± 8133978) 1.04
es/full/minify/libraries/react 19733020 ns/iter (± 1639881) 19831577 ns/iter (± 2225719) 1.00
es/full/minify/libraries/terser 333018148 ns/iter (± 21199233) 309356165 ns/iter (± 34097404) 1.08
es/full/minify/libraries/three 591735913 ns/iter (± 34324119) 555675203 ns/iter (± 59189460) 1.06
es/full/minify/libraries/typescript 3883377462 ns/iter (± 141307767) 3663338702 ns/iter (± 172334047) 1.06
es/full/minify/libraries/victory 795977332 ns/iter (± 31526643) 780388873 ns/iter (± 38985180) 1.02
es/full/minify/libraries/vue 163432551 ns/iter (± 9849640) 153387141 ns/iter (± 14410812) 1.07
es/full/codegen/es3 38567 ns/iter (± 6742) 32630 ns/iter (± 1118) 1.18
es/full/codegen/es5 37005 ns/iter (± 6975) 32726 ns/iter (± 1711) 1.13
es/full/codegen/es2015 35962 ns/iter (± 5791) 32627 ns/iter (± 1218) 1.10
es/full/codegen/es2016 33914 ns/iter (± 5510) 32411 ns/iter (± 760) 1.05
es/full/codegen/es2017 34558 ns/iter (± 5703) 32670 ns/iter (± 931) 1.06
es/full/codegen/es2018 34737 ns/iter (± 4692) 32590 ns/iter (± 854) 1.07
es/full/codegen/es2019 33844 ns/iter (± 5176) 32669 ns/iter (± 1364) 1.04
es/full/codegen/es2020 33828 ns/iter (± 3221) 32578 ns/iter (± 1175) 1.04
es/full/all/es3 212970540 ns/iter (± 15141608) 202497107 ns/iter (± 23761201) 1.05
es/full/all/es5 202040426 ns/iter (± 18619594) 191000738 ns/iter (± 23974304) 1.06
es/full/all/es2015 165578776 ns/iter (± 16456438) 166219732 ns/iter (± 20544736) 1.00
es/full/all/es2016 163545268 ns/iter (± 18223218) 167317558 ns/iter (± 10923784) 0.98
es/full/all/es2017 163510855 ns/iter (± 17412468) 167802385 ns/iter (± 17272933) 0.97
es/full/all/es2018 160111665 ns/iter (± 13683078) 146410228 ns/iter (± 9673575) 1.09
es/full/all/es2019 152803800 ns/iter (± 18658469) 146481199 ns/iter (± 18901593) 1.04
es/full/all/es2020 155677106 ns/iter (± 13015394) 152468749 ns/iter (± 13286728) 1.02
es/full/parser 809903 ns/iter (± 71357) 779731 ns/iter (± 55884) 1.04
es/full/base/fixer 32166 ns/iter (± 3836) 30414 ns/iter (± 1781) 1.06
es/full/base/resolver_and_hygiene 93174 ns/iter (± 12743) 91356 ns/iter (± 4518) 1.02
serialization of ast node 240 ns/iter (± 37) 215 ns/iter (± 8) 1.12
serialization of serde 243 ns/iter (± 38) 229 ns/iter (± 9) 1.06

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.