From f1d4c7c1dbeb0dc863ee95b21f2a8aaf1f352131 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Fri, 1 Feb 2019 23:59:58 +0200 Subject: [PATCH] Add linux-arm64, android-arm and android-arm64 prebuilds (#587) * Add linux-arm64, android-arm and android-arm64 prebuilds * 5.0.0-2-arm * Disable package-lock.json * Disable android for now * Use plain docker for linux and armv7/arm64 * Print out file type after build * 5.0.0-2-docker * Print out users and groups * Print out environment * Only do linux-armv7 for now * Run docker with user travis on Travis * 5.0.0-2-docker2 * Revert "Only do linux-armv7 for now" This reverts commit 92bb36ea7dd5852f9bd5bd7af06d3bc3c8aa8003. * Clean up * Update arm64 script * 5.0.0-2-docker3 * Add back android armv7 * 5.0.0-2-docker4 * Add back android arm64 * 5.0.0-2-docker5 * Actually run prebuild-android-arm64 * 5.0.0-2-docker6 * Refactor into cross-compile script + remove prebuildify-cross dependency * Revert temporary version * Remove -it --- .npmrc | 1 + .travis.yml | 3 ++- package.json | 7 +++++-- scripts/cross-compile | 7 +++++++ 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 .npmrc create mode 100755 scripts/cross-compile diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..9cf94950 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 90551fa0..71ba60c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ jobs: - name: arm os: linux node_js: node - env: [BUILD_CMD=prebuildify-cross-armv7, BUILD_GROUP=arm] + env: [BUILD_CMD=prebuild-arm, BUILD_GROUP=arm] if: tag is present script: @@ -35,6 +35,7 @@ after_success: before_deploy: - export ARCHIVE_NAME="${TRAVIS_TAG:-latest}-$BUILD_GROUP.tar.gz" - npm run $BUILD_CMD + - file prebuilds/*/* - tar -zcvf "$ARCHIVE_NAME" -C prebuilds . deploy: diff --git a/package.json b/package.json index cde9adb1..e3ece591 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,11 @@ "hallmark": "hallmark --fix", "dependency-check": "dependency-check . test/*.js bench/*.js", "prepublishOnly": "npm run dependency-check", - "prebuildify-cross-armv7": "prebuildify-cross --platform=linux --arch=arm --arm-version=7 -- -t 8.14.0 --napi --strip" + "prebuild-arm": "npm run prebuild-linux-armv7 && npm run prebuild-linux-arm64 && npm run prebuild-android-armv7 && npm run prebuild-android-arm64", + "prebuild-linux-armv7": "IMAGE=linux-armv7 ./scripts/cross-compile", + "prebuild-linux-arm64": "IMAGE=linux-arm64 ./scripts/cross-compile", + "prebuild-android-armv7": "IMAGE=android-armv7 ./scripts/cross-compile", + "prebuild-android-arm64": "IMAGE=android-arm64 ./scripts/cross-compile" }, "dependencies": { "abstract-leveldown": "~6.0.0", @@ -38,7 +42,6 @@ "optimist": "~0.6.1", "prebuildify": "prebuild/prebuildify#override-platform", "prebuildify-ci": "^1.0.4", - "prebuildify-cross": "ralphtheninja/prebuildify-cross#TARGET_PLATFORM", "readfiletree": "~0.0.1", "rimraf": "^2.6.1", "slump": "^3.0.0", diff --git a/scripts/cross-compile b/scripts/cross-compile new file mode 100755 index 00000000..378d9e1b --- /dev/null +++ b/scripts/cross-compile @@ -0,0 +1,7 @@ +#!/bin/bash + +DOCKER_USER="node" +if [[ "$TRAVIS" == "true" ]]; then DOCKER_USER="travis"; fi + +exec docker run -u ${DOCKER_USER} --rm -v $(pwd):/app prebuild/${IMAGE} \ + bash -c "npm i --ignore-scripts && npx prebuildify -t 8.14.0 --napi --strip"