diff --git a/.github/workflows/prebuilds.yml b/.github/workflows/prebuilds.yml index d56eb45..ebbdfff 100644 --- a/.github/workflows/prebuilds.yml +++ b/.github/workflows/prebuilds.yml @@ -1,11 +1,20 @@ -name: Generate prebuilds +name: Build, test, and release prebuilds + +# This workflow builds nodejs-mobile prebuilds for an npm-published native +# module across all standard targets, tests them on an Android emulator and +# iOS simulator, and publishes a GitHub Release with the artifacts. on: workflow_dispatch: inputs: - module_version: - description: "Module version" + module_name: + description: "npm module name" required: true + type: string + default: "crc-native" + module_version: + description: "Exact version or dist-tag" + required: false default: "latest" type: string publish_release: @@ -16,20 +25,28 @@ on: jobs: build: - strategy: - matrix: - platform: [android] - arch: [arm64, x64, arm] - uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/prebuild.yml@main + uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/prebuild-all.yml@v2 with: - module_name: "crc-native" + module_name: ${{ inputs.module_name }} module_version: ${{ inputs.module_version }} - platform: ${{ matrix.platform }} - arch: ${{ matrix.arch }} + + test-android: + needs: build + uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/test-android.yml@v2 + with: + module_spec: ${{ needs.build.outputs.module_spec }} + + test-ios: + needs: build + uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/test-ios.yml@v2 + with: + module_spec: ${{ needs.build.outputs.module_spec }} release: if: ${{ inputs.publish_release }} - needs: build - uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/release.yml@main + needs: [ build, test-android, test-ios ] + permissions: + contents: write + uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/release.yml@v2 with: - module_version: ${{ needs.build.outputs.module_version }} + module_spec: ${{ needs.build.outputs.module_spec }} diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 3c03207..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/README.md b/README.md index 328fa7b..6c37d76 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,25 @@ # crc-native-nodejs-mobile -[NodeJS Mobile](https://github.com/nodejs-mobile/nodejs-mobile) prebuilds for [`crc-native`](https://github.com/holepunchto/crc-native) +[NodeJS Mobile](https://github.com/nodejs-mobile/nodejs-mobile) prebuilds for +[`crc-native`](https://github.com/holepunchto/crc-native) ## Working locally ### Requirements -- Node 18 -- Android NDK (CI uses version 27.2.12479018) +- Android NDK - (optional) exported `ANDROID_NDK_HOME` environment variable ### General steps -Should be clear enough to follow the [reusable workflow steps](https://github.com/digidem/nodejs-mobile-bare-prebuilds/blob/main/.github/workflows/prebuild.yml) but in summary: +Should be clear enough to follow the +[reusable workflow steps](https://github.com/digidem/nodejs-mobile-bare-prebuilds/blob/main/.github/workflows/prebuild.yml) +but in summary: 1. Download the npm tarball package and unzip e.g. - ``` - npm pack crc-native@latest | xargs tar -zxvf - ``` + ``` + npm pack crc-native@latest | xargs tar -zxvf + ``` 2. Navigate to unzipped directory: ``` cd package @@ -26,7 +28,8 @@ Should be clear enough to follow the [reusable workflow steps](https://github.co ``` npm install ``` -4. Install [patched `cmake-napi`](https://github.com/digidem/cmake-napi-nodejs-mobile): +4. Install + [patched `cmake-napi`](https://github.com/digidem/cmake-napi-nodejs-mobile): ``` npm install cmake-napi@github:digidem/cmake-napi-nodejs-mobile ``` @@ -43,13 +46,17 @@ Should be clear enough to follow the [reusable workflow steps](https://github.co ## Creating a release -1. Navigate to the [Generate Prebuilds workflow](https://github.com/digidem/crc-native-nodejs-mobile/actions/workflows/prebuilds.yml) -2. Manually dispatch the worflow with the version you want to build, ensuring that "Publish Release" is checked. +1. Navigate to the + [Generate Prebuilds workflow](https://github.com/digidem/crc-native-nodejs-mobile/actions/workflows/prebuilds.yml) +2. Manually dispatch the worflow with the version you want to build, ensuring + that "Publish Release" is checked. ## Contributing -We welcome contributions to this repository. If you have an idea for a new feature or have found a bug, please open an issue or submit a pull request. +We welcome contributions to this repository. If you have an idea for a new +feature or have found a bug, please open an issue or submit a pull request. ## License -This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file +for more details.