From 9b710597451acd778b06dcbda035784ddb07f2cb Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 2 Dec 2021 13:11:32 +0800 Subject: [PATCH] ci: add armv7 android build --- .github/workflows/android-armv7.yml | 15 +++++++++------ .github/workflows/android.yml | 14 +++++++------- README.md | 1 + package.json | 23 ++++++----------------- 4 files changed, 23 insertions(+), 30 deletions(-) diff --git a/.github/workflows/android-armv7.yml b/.github/workflows/android-armv7.yml index 989a9a95..937b1e3a 100644 --- a/.github/workflows/android-armv7.yml +++ b/.github/workflows/android-armv7.yml @@ -49,21 +49,24 @@ jobs: uses: actions/cache@v2 with: path: ~/.cargo/git - key: stable-macos-android-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} + key: stable-linux-android-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} - name: Cache NPM dependencies uses: actions/cache@v2 with: path: node_modules - key: npm-cache-macos-android-node@16-${{ hashFiles('yarn.lock') }} + key: npm-cache-linux-android-node@16-${{ hashFiles('yarn.lock') }} - name: Install dependencies - run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 + run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 - name: 'Build TypeScript' run: yarn build - - name: Cross build native tests + - name: Cross build run: | - export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang" - yarn build:test:android + export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang" + yarn build:test:android:armv7 + du -sh examples/napi/index.node + ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip examples/napi/index.node + du -sh examples/napi/index.node diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 866a1fed..529120f3 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,4 +1,4 @@ -name: macOS-Android +name: Android-aarch64 on: push: @@ -12,12 +12,12 @@ env: jobs: build-android-aarch64: name: Build - Android - aarch64 - runs-on: macos-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: 16 cache: 'yarn' @@ -43,19 +43,19 @@ jobs: uses: actions/cache@v2 with: path: ~/.cargo/registry - key: stable-macos-android-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }} + key: stable-linux-android-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo index uses: actions/cache@v2 with: path: ~/.cargo/git - key: stable-macos-android-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} + key: stable-linux-android-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} - name: Cache NPM dependencies uses: actions/cache@v2 with: path: node_modules - key: npm-cache-macos-android-node@16-${{ hashFiles('yarn.lock') }} + key: npm-cache-linux-android-node@16-${{ hashFiles('yarn.lock') }} - name: Install dependencies run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 @@ -65,5 +65,5 @@ jobs: - name: Cross build native tests run: | - export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang" + export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang" yarn build:test:android diff --git a/README.md b/README.md index d30994bc..732ab527 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ _Main branch is now under napi@next developing. Checkout [v1 docs](https://napi. | Linux aarch64 musl | ✓ | ✓ | ✓ | ✓ | | Linux arm gnueabihf | ✓ | ✓ | ✓ | ✓ | | Linux aarch64 android | ✓ | ✓ | ✓ | ✓ | +| Linux armv7 android | ✓ | ✓ | ✓ | ✓ | | FreeBSD x64 | ✓ | ✓ | ✓ | ✓ | This library depends on Node-API and requires `Node@10.0.0` or later. diff --git a/package.json b/package.json index 4a264373..fc5f3fb5 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,7 @@ "version": "0.0.0", "description": "A minimal library for building compiled Node add-ons in Rust.", "private": "true", - "workspaces": [ - "cli", - "triples", - "memory-testing" - ], + "workspaces": ["cli", "triples", "memory-testing"], "repository": { "type": "git", "url": "git@github.com:Brooooooklyn/napi-rs.git" @@ -21,6 +17,7 @@ "build:test": "yarn --cwd ./examples/napi-compat-mode build && yarn --cwd ./examples/napi build", "build:test:aarch64": "yarn --cwd ./examples/napi-compat-mode build-aarch64 && yarn --cwd ./examples/napi build-aarch64", "build:test:android": "yarn --cwd ./examples/napi-compat-mode build --target aarch64-linux-android && yarn --cwd ./examples/napi build --target aarch64-linux-android", + "build:test:android:armv7": "yarn --cwd ./examples/napi-compat-mode build --target armv7-linux-androideabi && yarn --cwd ./examples/napi build --target armv7-linux-androideabi", "build:test:armv7": "yarn --cwd ./examples/napi-compat-mode build-armv7 && yarn --cwd ./examples/napi build-armv7", "bundle": "rollup -c rollup.config.js", "format": "run-p format:md format:json format:yaml format:source format:rs", @@ -48,18 +45,10 @@ "arrowParens": "always" }, "lint-staged": { - "*.js": [ - "prettier --write" - ], - "*.@(yml|yaml)": [ - "prettier --parser yaml --write" - ], - "*.json": [ - "prettier --parser json --write" - ], - "*.md": [ - "prettier --parser markdown --write" - ] + "*.js": ["prettier --write"], + "*.@(yml|yaml)": ["prettier --parser yaml --write"], + "*.json": ["prettier --parser json --write"], + "*.md": ["prettier --parser markdown --write"] }, "husky": { "hooks": {