-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
2,333 additions
and
999 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Build and Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
x86_64: | ||
name: x86_64 | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 10 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-12, macos-13, ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022] | ||
node: [20, 21] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js v${{ matrix.node }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: yarn | ||
registry-url: https://registry.yarnpkg.org/ | ||
|
||
- name: Install dependencies | ||
run: yarn --mode=skip-build | ||
|
||
- name: Build from source | ||
run: yarn build:from-source | ||
|
||
- name: Package | ||
run: yarn build | ||
|
||
- name: Test | ||
run: yarn vitest run | ||
|
||
aarch64: | ||
name: aarch64 | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 10 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-20.04, ubuntu-22.04] | ||
node: [20, 21] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js v${{ matrix.node }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: yarn | ||
registry-url: https://registry.yarnpkg.org/ | ||
|
||
- name: Install dependencies | ||
run: yarn --mode=skip-build | ||
|
||
- name: Build from source | ||
run: yarn build:from-source | ||
|
||
- name: Package build | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ yarn node-pre-gyp --target_arch=arm64 configure build package | ||
- name: Build TypeScript | ||
run: yarn tsc --build | ||
|
||
- name: Test | ||
run: yarn vitest run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
x86_64: | ||
name: Prebuild x86_64 | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-12, macos-13, ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022] | ||
node: [20, 21] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js v${{ matrix.node }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: yarn | ||
registry-url: https://registry.yarnpkg.org/ | ||
|
||
- name: Install dependencies | ||
run: yarn --mode=skip-build | ||
|
||
- name: Build from source | ||
run: yarn build:from-source | ||
|
||
- name: Package | ||
run: yarn build | ||
|
||
- name: Upload | ||
uses: ./scripts/prebuild | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
path: "build/stage/**/*.tar.gz" | ||
|
||
aarch64: | ||
name: Prebuild aarch64 | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-20.04, ubuntu-22.04] | ||
node: [20, 21] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8.15.0 | ||
|
||
- name: Use Node.js v${{ matrix.node }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: pnpm | ||
|
||
- name: Install dependencies | ||
run: yarn --mode=skip-build | ||
|
||
- name: Build from source | ||
run: yarn build:from-source | ||
|
||
- name: Package prebuild | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ yarn node-pre-gyp --target_arch=arm64 configure build package | ||
- name: Build TypeScript | ||
run: yarn tsc --build | ||
|
||
- name: Upload | ||
uses: ./scripts/prebuild | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
path: "build/stage/**/*.tar.gz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
build | ||
build | ||
prebuild | ||
!scripts/prebuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "inspectPromise", | ||
"target_name": "<(module_name)", | ||
"sources": [ | ||
"src/binding.cc" | ||
] | ||
], | ||
"product_dir": "<(module_path)" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { describe, expect, test } from "vitest"; | ||
import { inspectPromise } from "./"; | ||
|
||
describe("inspectPromise", () => { | ||
test("pending", () => { | ||
const p = new Promise(() => {}); | ||
const details = inspectPromise(p); | ||
|
||
expect(details.state).toBe("pending"); | ||
expect(details.value).toBe(undefined); | ||
}); | ||
|
||
test("fulfilled", () => { | ||
const p = Promise.resolve(42); | ||
const details = inspectPromise(p); | ||
|
||
expect(details.state).toBe("fulfilled"); | ||
expect(details.value).toBe(42); | ||
}); | ||
|
||
// rejected case not covered for ci | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module "@mapbox/node-pre-gyp" { | ||
function find(path: string): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.