Skip to content

Commit

Permalink
Merge pull request #74 from Brooooooklyn/win-i686-codegen-units
Browse files Browse the repository at this point in the history
feat: support windows i686
  • Loading branch information
Brooooooklyn authored Jan 28, 2021
2 parents a7ef2ec + 3b7483c commit 808293b
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 9 deletions.
95 changes: 86 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ jobs:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 14
check-latest: true

- name: Install
uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -89,6 +90,76 @@ jobs:
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache
build-windows-i686:
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: stable - windows-i686 - node@14
runs-on: windows-latest
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 32
CARGO_PROFILE_RELEASE_LTO: 'false'
steps:
- uses: actions/checkout@v2

- name: Install node x86
run: |
choco install nodejs-lts --x86 -y --force
refreshenv
- name: Set 32bit NodeJS path
run: |
echo "C:\\Program Files (x86)\\nodejs" >> $GITHUB_PATH
shell: bash

- name: NodeJS arch
run: node -e "console.log(process.arch)"

- name: Cache NPM dependencies
uses: actions/cache@v1
with:
path: node_modules
key: npm-cache-windows-i686-node@lts-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

- name: Install
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Install i686 toolchain
run: rustup target add i686-pc-windows-msvc

- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile

- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: stable-windows-i686-node@lts-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: stable-windows-i686-node@lts-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Cross build i686
run: yarn build --target i686-pc-windows-msvc

- name: Test binary
run: yarn test

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: bindings-win32-i686
path: ${{ env.APP_NAME }}.*.node

build-musl:
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: stable - linux-musl - node@12
Expand Down Expand Up @@ -156,7 +227,7 @@ jobs:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v2
with:
node-version: 14
check-latest: true
Expand Down Expand Up @@ -219,7 +290,7 @@ jobs:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v2
with:
node-version: 14
check-latest: true
Expand Down Expand Up @@ -279,9 +350,10 @@ jobs:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 14
check-latest: true

- name: Install
uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -340,9 +412,10 @@ jobs:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 14
check-latest: true

- name: Install aarch64 toolchain
run: rustup target add aarch64-linux-android
Expand Down Expand Up @@ -400,9 +473,10 @@ jobs:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
check-latest: true

- name: Cache NPM dependencies
uses: actions/cache@v1
Expand Down Expand Up @@ -478,7 +552,7 @@ jobs:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
check-latest: true
Expand Down Expand Up @@ -518,6 +592,7 @@ jobs:
- build-apple-silicon
- build-android-aarch64
- build-linux-arm7
- build-windows-i686
- test-binding
- test-musl-binding
- test-linux-aarch64
Expand All @@ -535,18 +610,20 @@ jobs:
needs:
- test-binding
- test-musl-binding
- test-linux-aarch64
- build-windows-i686
- build-android-aarch64
- build-linux-arm7
- build-apple-silicon
- test-linux-aarch64

steps:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 14
check-latest: true

- name: Cache NPM dependencies
uses: actions/cache@v1
Expand Down
3 changes: 3 additions & 0 deletions npm/win32-ia32-msvc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `@napi-rs/pinyin-win32-ia32-msvc`

This is the **i686-pc-windows-msvc** binary for `@napi-rs/pinyin`
32 changes: 32 additions & 0 deletions npm/win32-ia32-msvc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@napi-rs/pinyin-win32-ia32-msvc",
"version": "1.5.0",
"os": ["win32"],
"cpu": ["ia32"],
"main": "pinyin.win32-ia32-msvc.node",
"files": ["pinyin.win32-ia32-msvc.node"],
"description": "Fastest Chinese words to pinyin library",
"keywords": [
"napi-rs",
"NAPI",
"N-API",
"Rust",
"node-addon",
"node-addon-api",
"pinyin",
"jieba",
"拼音",
"汉语",
"汉字",
"中文"
],
"license": "MIT",
"engines": {
"node": ">= 10.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "[email protected]:Brooooooklyn/pinyin.git"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"additional": [
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"i686-pc-windows-msvc",
"aarch64-unknown-linux-gnu",
"aarch64-apple-darwin",
"aarch64-linux-android"
Expand Down

0 comments on commit 808293b

Please sign in to comment.