Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 55 additions & 47 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
- name: Install pnpm before setup node
shell: bash
run: npm install -g pnpm
- name: Setup node
uses: actions/setup-node@v4
with:
Expand All @@ -34,9 +37,9 @@ jobs:
with:
components: clippy, rustfmt
- name: Install dependencies
run: yarn install
run: pnpm install
- name: Oxlint
run: yarn lint
run: pnpm lint
- name: Cargo fmt
run: cargo fmt -- --check
- name: Clippy
Expand All @@ -49,54 +52,57 @@ jobs:
# Mac
- host: macos-latest
target: aarch64-apple-darwin
build: yarn build --target aarch64-apple-darwin
build: pnpm build --target aarch64-apple-darwin

# Windows
- host: windows-latest
build: yarn build --target x86_64-pc-windows-msvc
build: pnpm build --target x86_64-pc-windows-msvc
target: x86_64-pc-windows-msvc

# Linux
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
build: yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
build: pnpm build --target x86_64-unknown-linux-gnu --use-napi-cross
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
build: yarn build --target x86_64-unknown-linux-musl -x
build: pnpm build --target x86_64-unknown-linux-musl -x
- host: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
build: yarn build --target aarch64-unknown-linux-gnu
build: pnpm build --target aarch64-unknown-linux-gnu
- host: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
build: yarn build --target aarch64-unknown-linux-musl -x
build: pnpm build --target aarch64-unknown-linux-musl -x

# - host: windows-latest
# build: yarn build --target i686-pc-windows-msvc
# build: pnpm build --target i686-pc-windows-msvc
# target: i686-pc-windows-msvc
# - host: macos-latest
# target: x86_64-apple-darwin
# build: yarn build --target x86_64-apple-darwin
# build: pnpm build --target x86_64-apple-darwin
# - host: ubuntu-latest
# target: armv7-unknown-linux-gnueabihf
# build: yarn build --target armv7-unknown-linux-gnueabihf --use-napi-cross
# build: pnpm build --target armv7-unknown-linux-gnueabihf --use-napi-cross
# - host: ubuntu-latest
# target: aarch64-linux-android
# build: yarn build --target aarch64-linux-android
# build: pnpm build --target aarch64-linux-android
# - host: ubuntu-latest
# target: armv7-linux-androideabi
# build: yarn build --target armv7-linux-androideabi
# build: pnpm build --target armv7-linux-androideabi
# - host: windows-latest
# target: aarch64-pc-windows-msvc
# build: yarn build --target aarch64-pc-windows-msvc
# build: pnpm build --target aarch64-pc-windows-msvc
# - host: ubuntu-latest
# target: wasm32-wasip1-threads
# build: yarn build --target wasm32-wasip1-threads
# build: pnpm build --target wasm32-wasip1-threads
name: stable - ${{ matrix.settings.target }} - node@22
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
submodules: 'recursive'
- name: Install pnpm before setup node
shell: bash
run: npm install -g pnpm
- name: Setup node
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -135,7 +141,7 @@ jobs:
if: ${{ matrix.settings.setup }}
shell: bash
- name: Install dependencies
run: yarn install
run: pnpm install
- name: Build
run: ${{ matrix.settings.build }}
shell: bash
Expand All @@ -145,6 +151,7 @@ jobs:
name: bindings-${{ matrix.settings.target }}
path: "*.node"
if-no-files-found: error

test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
needs:
Expand All @@ -163,36 +170,36 @@ jobs:
# - host: macos-latest
# target: x86_64-apple-darwin
# architecture: x64
# - host: windows-11-arm
# target: aarch64-pc-windows-msvc
# - host: macos-latest
# target: aarch64-apple-darwin
# architecture: arm64
node:
- '20'
- '22'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
- uses: actions/checkout@v6
- name: setup pnpm
uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
cache: pnpm
architecture: ${{ matrix.settings.architecture }}
- name: Setup Core pack
run: corepack enable
- name: Install dependencies
run: yarn install
run: pnpm install
- name: Download artifacts
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: bindings-${{ matrix.settings.target }}
path: .
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: yarn test
run: pnpm test

test-linux-binding:
name: Test ${{ matrix.target }} - node@${{ matrix.node }}
needs:
Expand All @@ -210,15 +217,14 @@ jobs:
- '22'
runs-on: ${{ contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
- uses: actions/checkout@v6
- name: setup pnpm
uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
- name: Setup Core pack
run: corepack enable
cache: pnpm
- name: Output docker params
id: docker
run: |
Expand All @@ -238,13 +244,12 @@ jobs:
console.log('IMAGE=node:${{ matrix.node }}-slim')
}
" >> $GITHUB_OUTPUT
echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
# use --force to download the all platform/arch dependencies
- name: Install dependencies
run: |
yarn config set --json supportedArchitectures.cpu '["current", "arm64", "x64", "arm"]'
yarn config set --json supportedArchitectures.libc '["current", "musl", "gnu"]'
yarn install
run: pnpm install --force
- name: Download artifacts
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: bindings-${{ matrix.target }}
path: .
Expand All @@ -262,8 +267,9 @@ jobs:
uses: addnab/docker-run-action@v3
with:
image: ${{ steps.docker.outputs.IMAGE }}
options: -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}
run: corepack enable && yarn test
options: -v ${{ steps.docker.outputs.PNPM_STORE_PATH }}:${{ steps.docker.outputs.PNPM_STORE_PATH }} -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}
run: npm run test

publish:
name: Publish
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Expand All @@ -278,31 +284,33 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
submodules: 'recursive'
- name: Install pnpm before setup node
shell: bash
run: npm install -g pnpm
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup Core pack
run: corepack enable
- name: Install dependencies
run: yarn install
run: pnpm install
- name: create npm dirs
run: yarn napi create-npm-dirs
run: pnpm napi create-npm-dirs
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
path: artifacts
- name: Move artifacts
run: yarn artifacts
run: pnpm artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Publish
run: |
npm config set provenance true
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
pnpm publish --access public --provenance
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
14 changes: 1 addition & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down Expand Up @@ -69,9 +67,6 @@ typings/
# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test
Expand Down Expand Up @@ -187,11 +182,4 @@ $RECYCLE.BIN/
Cargo.lock

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

*.node
2 changes: 0 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ npm
.eslintrc
.prettierignore
rustfmt.toml
yarn.lock
*.node
.yarn
__test__
renovate.json
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ RUN make

WORKDIR /usr/src/hashtree-js

RUN yarn config set supportedArchitectures.cpu "arm64" &&\
yarn config set supportedArchitectures.libc "glibc" &&\
yarn install
RUN pnpm config set supportedArchitectures.cpu "arm64" &&\
pnpm config set supportedArchitectures.libc "glibc" &&\
pnpm install

RUN yarn build --target aarch64-unknown-linux-gnu
RUN pnpm build --target aarch64-unknown-linux-gnu

RUN yarn test
RUN pnpm test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@
"url": "https://github.com/ChainSafe/hashtree-js/issues"
},
"homepage": "https://github.com/ChainSafe/hashtree-js#readme",
"packageManager": "[email protected]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's interesting, so it looks like we weren't even using yarn 1 here

"packageManager": "[email protected]"
}
Loading