Skip to content

Commit

Permalink
feat: Initial GitHub workflow action for build NPM package
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarek-kindred committed Sep 26, 2023
1 parent d66ea6a commit 0fb4256
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 4 deletions.
51 changes: 51 additions & 0 deletions .github/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name:
on:
workflow_call:
env:
SDK_JS_HOME: cohort_sdk_js
jobs:
npm:
strategy:
matrix:
settings:
- host: macos-latest
target: darwin-arm64
buildCommand: |
cd $SDK_JS_HOME && npm run build -- --target darwin-arm64
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true

- name: Install
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
toolchain: stable
target: ${{ matrix.settings.target }}

- name: List content before build
shell: bash
run: ls -l

# - name: Cache cargo TODO deal with caching
- name: Install node dependencies
run: cd $SDK_JS_HOME && npm install

- name: Cargo build
run: cargo build

- name: Build
shell: bash
run: ${{ matrix.settings.buildCommand }}

- name: List content after build
shell: bash
run: ls -l
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- run: rustup component add rustfmt clippy
- name: cargo build
run: cargo build --release
- run: scripts/pre-commit-checks.sh
- run: scripts/pre-commit-checks.sh
2 changes: 2 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
uses: ./.github/workflows/build.yml
coverage:
uses: ./.github/workflows/coverage.yml
coverage:
uses: ./.github/workflows/npm.yml



Expand Down
18 changes: 18 additions & 0 deletions packages/cohort_sdk_js/npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "cohort_sdk_js-darwin-arm64",
"version": "0.0.1",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "cohort_sdk_js.darwin-arm64.node",
"files": [
"cohort_sdk_js.darwin-arm64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
15 changes: 15 additions & 0 deletions packages/cohort_sdk_js/npm/darwin-universal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "cohort_sdk_js-darwin-universal",
"version": "0.0.1",
"os": [
"darwin"
],
"main": "cohort_sdk_js.darwin-universal.node",
"files": [
"cohort_sdk_js.darwin-universal.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
18 changes: 18 additions & 0 deletions packages/cohort_sdk_js/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "cohort_sdk_js-darwin-x64",
"version": "0.0.1",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "cohort_sdk_js.darwin-x64.node",
"files": [
"cohort_sdk_js.darwin-x64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
18 changes: 18 additions & 0 deletions packages/cohort_sdk_js/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "cohort_sdk_js-linux-x64",
"version": "0.0.1",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "cohort_sdk_js.linux-x64.node",
"files": [
"cohort_sdk_js.linux-x64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
18 changes: 18 additions & 0 deletions packages/cohort_sdk_js/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "cohort_sdk_js-win32-x64-msvc",
"version": "0.0.1",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "cohort_sdk_js.win32-x64-msvc.node",
"files": [
"cohort_sdk_js.win32-x64-msvc.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
6 changes: 3 additions & 3 deletions packages/cohort_sdk_js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cohort_sdk_js",
"version": "0.1.13",
"version": "0.0.1",
"main": "index.js",
"types": "index.d.ts",
"napi": {
Expand All @@ -26,7 +26,7 @@
"node": ">= 10"
},
"scripts": {
"artifacts": "napi artifacts",
"artifacts": "napi artifacts -d .",
"build": "napi build --platform --release",
"build:debug": "napi build --platform",
"test": "ava",
Expand All @@ -42,4 +42,4 @@
"cohort_sdk_js-darwin-arm64": "0.0.1",
"cohort_sdk_js-darwin-universal": "0.0.1"
}
}
}

0 comments on commit 0fb4256

Please sign in to comment.