Skip to content

Commit

Permalink
chore(ci): Fix build for Android platforms (#5317)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn authored Jul 27, 2022
1 parent 20cafc1 commit 18d4029
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

2 comments on commit 18d4029

@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: 18d4029 Previous: c80b9e1 Ratio
es/full/minify/libraries/antd 1713169806 ns/iter (± 89597961) 1718906137 ns/iter (± 48166125) 1.00
es/full/minify/libraries/d3 424699170 ns/iter (± 32525750) 419425919 ns/iter (± 15863616) 1.01
es/full/minify/libraries/echarts 1630723360 ns/iter (± 90461072) 1676337104 ns/iter (± 48691324) 0.97
es/full/minify/libraries/jquery 101435711 ns/iter (± 19348228) 107850673 ns/iter (± 10045842) 0.94
es/full/minify/libraries/lodash 124870145 ns/iter (± 15189436) 157623771 ns/iter (± 14079357) 0.79
es/full/minify/libraries/moment 55464027 ns/iter (± 6953797) 58907684 ns/iter (± 8133978) 0.94
es/full/minify/libraries/react 19491581 ns/iter (± 2178901) 19831577 ns/iter (± 2225719) 0.98
es/full/minify/libraries/terser 313225651 ns/iter (± 29667647) 309356165 ns/iter (± 34097404) 1.01
es/full/minify/libraries/three 572515876 ns/iter (± 47615837) 555675203 ns/iter (± 59189460) 1.03
es/full/minify/libraries/typescript 3506007008 ns/iter (± 130490367) 3663338702 ns/iter (± 172334047) 0.96
es/full/minify/libraries/victory 740867235 ns/iter (± 9340089) 780388873 ns/iter (± 38985180) 0.95
es/full/minify/libraries/vue 137876604 ns/iter (± 9599679) 153387141 ns/iter (± 14410812) 0.90
es/full/codegen/es3 32805 ns/iter (± 1854) 32630 ns/iter (± 1118) 1.01
es/full/codegen/es5 32577 ns/iter (± 1371) 32726 ns/iter (± 1711) 1.00
es/full/codegen/es2015 32792 ns/iter (± 2634) 32627 ns/iter (± 1218) 1.01
es/full/codegen/es2016 32804 ns/iter (± 2148) 32411 ns/iter (± 760) 1.01
es/full/codegen/es2017 32645 ns/iter (± 3287) 32670 ns/iter (± 931) 1.00
es/full/codegen/es2018 32782 ns/iter (± 2119) 32590 ns/iter (± 854) 1.01
es/full/codegen/es2019 32843 ns/iter (± 1182) 32669 ns/iter (± 1364) 1.01
es/full/codegen/es2020 32707 ns/iter (± 2515) 32578 ns/iter (± 1175) 1.00
es/full/all/es3 200581778 ns/iter (± 15770293) 202497107 ns/iter (± 23761201) 0.99
es/full/all/es5 189116811 ns/iter (± 14910988) 191000738 ns/iter (± 23974304) 0.99
es/full/all/es2015 151584570 ns/iter (± 10090090) 166219732 ns/iter (± 20544736) 0.91
es/full/all/es2016 155321534 ns/iter (± 17932136) 167317558 ns/iter (± 10923784) 0.93
es/full/all/es2017 151611053 ns/iter (± 13865679) 167802385 ns/iter (± 17272933) 0.90
es/full/all/es2018 150208525 ns/iter (± 12133938) 146410228 ns/iter (± 9673575) 1.03
es/full/all/es2019 163318463 ns/iter (± 20762327) 146481199 ns/iter (± 18901593) 1.11
es/full/all/es2020 159134131 ns/iter (± 17497402) 152468749 ns/iter (± 13286728) 1.04
es/full/parser 780711 ns/iter (± 102679) 779731 ns/iter (± 55884) 1.00
es/full/base/fixer 32411 ns/iter (± 5741) 30414 ns/iter (± 1781) 1.07
es/full/base/resolver_and_hygiene 89755 ns/iter (± 7268) 91356 ns/iter (± 4518) 0.98
serialization of ast node 214 ns/iter (± 6) 215 ns/iter (± 8) 1.00
serialization of serde 246 ns/iter (± 27) 229 ns/iter (± 9) 1.07

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

@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: 18d4029 Previous: c80b9e1 Ratio
es/full/minify/libraries/antd 1620234233 ns/iter (± 26660999) 1718906137 ns/iter (± 48166125) 0.94
es/full/minify/libraries/d3 407570085 ns/iter (± 11957527) 419425919 ns/iter (± 15863616) 0.97
es/full/minify/libraries/echarts 1587349992 ns/iter (± 36947658) 1676337104 ns/iter (± 48691324) 0.95
es/full/minify/libraries/jquery 89147125 ns/iter (± 3250370) 107850673 ns/iter (± 10045842) 0.83
es/full/minify/libraries/lodash 117071217 ns/iter (± 1032952) 157623771 ns/iter (± 14079357) 0.74
es/full/minify/libraries/moment 52163839 ns/iter (± 638625) 58907684 ns/iter (± 8133978) 0.89
es/full/minify/libraries/react 17085718 ns/iter (± 187065) 19831577 ns/iter (± 2225719) 0.86
es/full/minify/libraries/terser 289270667 ns/iter (± 7886625) 309356165 ns/iter (± 34097404) 0.94
es/full/minify/libraries/three 536878954 ns/iter (± 14037807) 555675203 ns/iter (± 59189460) 0.97
es/full/minify/libraries/typescript 3428548766 ns/iter (± 67104592) 3663338702 ns/iter (± 172334047) 0.94
es/full/minify/libraries/victory 721764348 ns/iter (± 3188356) 780388873 ns/iter (± 38985180) 0.92
es/full/minify/libraries/vue 129306029 ns/iter (± 5830106) 153387141 ns/iter (± 14410812) 0.84
es/full/codegen/es3 32261 ns/iter (± 972) 32630 ns/iter (± 1118) 0.99
es/full/codegen/es5 32299 ns/iter (± 1589) 32726 ns/iter (± 1711) 0.99
es/full/codegen/es2015 32327 ns/iter (± 482) 32627 ns/iter (± 1218) 0.99
es/full/codegen/es2016 32388 ns/iter (± 937) 32411 ns/iter (± 760) 1.00
es/full/codegen/es2017 32341 ns/iter (± 667) 32670 ns/iter (± 931) 0.99
es/full/codegen/es2018 32356 ns/iter (± 1410) 32590 ns/iter (± 854) 0.99
es/full/codegen/es2019 32319 ns/iter (± 751) 32669 ns/iter (± 1364) 0.99
es/full/codegen/es2020 32345 ns/iter (± 909) 32578 ns/iter (± 1175) 0.99
es/full/all/es3 187354199 ns/iter (± 6819833) 202497107 ns/iter (± 23761201) 0.93
es/full/all/es5 175365530 ns/iter (± 8781740) 191000738 ns/iter (± 23974304) 0.92
es/full/all/es2015 143084969 ns/iter (± 3573587) 166219732 ns/iter (± 20544736) 0.86
es/full/all/es2016 142753571 ns/iter (± 4052890) 167317558 ns/iter (± 10923784) 0.85
es/full/all/es2017 142833982 ns/iter (± 4180255) 167802385 ns/iter (± 17272933) 0.85
es/full/all/es2018 140883636 ns/iter (± 4121368) 146410228 ns/iter (± 9673575) 0.96
es/full/all/es2019 139945317 ns/iter (± 3188583) 146481199 ns/iter (± 18901593) 0.96
es/full/all/es2020 135536978 ns/iter (± 3229258) 152468749 ns/iter (± 13286728) 0.89
es/full/parser 752011 ns/iter (± 16364) 779731 ns/iter (± 55884) 0.96
es/full/base/fixer 29238 ns/iter (± 759) 30414 ns/iter (± 1781) 0.96
es/full/base/resolver_and_hygiene 86421 ns/iter (± 3438) 91356 ns/iter (± 4518) 0.95
serialization of ast node 215 ns/iter (± 3) 215 ns/iter (± 8) 1
serialization of serde 228 ns/iter (± 5) 229 ns/iter (± 9) 1.00

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

Please sign in to comment.