Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
64 changes: 2 additions & 62 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,66 +52,6 @@ jobs:
uses: rspack-contrib/rspack-toolchain/.github/workflows/build.yml@main

test:
runs-on: ${{ matrix.os }}
name: Node Test (${{ matrix.os }})
name: Test
uses: ./.github/workflows/test.yml
needs: build

strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get NAPI info
id: napi-info
uses: rspack-contrib/rspack-toolchain/get-napi-info@main

- name: Download rspack binding
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@main
with:
target: ${{ matrix.target }}
path: ${{ steps.napi-info.outputs.binding-path }}

- name: Show binding
shell: bash
run: |
echo "Contents of binding directory:"
ls -la ${{ steps.napi-info.outputs.binding-path }}
echo ""
echo "*.node files:"
find ${{ steps.napi-info.outputs.binding-path }} -name "*.node" -type f -exec ls -la {} \; || echo "No .node files found"

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Enable corepack
run: corepack enable

- name: Setup pnpm
run: corepack prepare

- name: Cache pnpm dependencies
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-

- name: Install dependencies
run: pnpm install

- name: Run example - plugin
run: node build.js
working-directory: examples/plugin
88 changes: 88 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Release

on:
workflow_dispatch:
inputs:
dry-run:
description: 'Run in dry-run mode (no actual publishing)'
required: false
default: true
type: boolean
npm-tag:
description: 'NPM tag for publishing'
required: false
default: 'latest'
type: choice
options:
- latest
- alpha
- beta
- canary

jobs:
build:
name: Build
uses: rspack-contrib/rspack-toolchain/.github/workflows/build.yml@main
with:
napi-build-command: pnpm build --release

test:
name: Test
uses: ./.github/workflows/test.yml

release:
runs-on: ubuntu-latest
name: Release
permissions:
contents: write
needs: [build, test]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Display release mode
run: |
echo "🚀 Release Configuration:"
echo " - Dry-run mode: ${{ inputs.dry-run }}"
echo " - NPM tag: ${{ inputs.npm-tag || 'latest' }}"
if [ "${{ inputs.dry-run }}" == "true" ]; then
echo " - ⚠️ This is a DRY RUN - no packages will be published"
else
echo " - 📦 This will PUBLISH packages to npm"
fi

- name: Get NAPI info
id: napi-info
uses: rspack-contrib/rspack-toolchain/get-napi-info@main

- name: Download rspack binding
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@main
with:
path: ${{ steps.napi-info.outputs.binding-path }}/artifacts

- name: List artifacts
run: ls -R artifacts
working-directory: ${{ steps.napi-info.outputs.binding-path }}

- name: Create npm dirs
run: pnpm napi create-npm-dirs
working-directory: ${{ steps.napi-info.outputs.binding-path }}

- name: Move artifacts
run: pnpm napi artifacts
working-directory: ${{ steps.napi-info.outputs.binding-path }}

- name: List npm dirs
run: ls -R npm
working-directory: ${{ steps.napi-info.outputs.binding-path }}

- name: Link optionalDependencies in binding package.json
run: pnpm napi pre-publish -t npm
working-directory: ${{ steps.napi-info.outputs.binding-path }}

- name: Release npm packages
run: |
pnpm publish -r --tag ${{ inputs.npm-tag }} --no-git-checks --provenance --access public ${{ inputs.dry-run && '--dry-run' || '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Test

on:
workflow_call:

jobs:
test:
runs-on: ${{ matrix.os }}
name: Node Test (${{ matrix.os }})

strategy:
fail-fast: false
matrix:
include:
# - os: ubuntu-latest
# target: x86_64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
# - os: windows-latest
# target: x86_64-pc-windows-msvc

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get NAPI info
id: napi-info
uses: rspack-contrib/rspack-toolchain/get-napi-info@main

- name: Download rspack binding
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@main
with:
target: ${{ matrix.target }}
path: ${{ steps.napi-info.outputs.binding-path }}

- name: Show binding
shell: bash
run: |
echo "Contents of binding directory:"
ls -la ${{ steps.napi-info.outputs.binding-path }}
echo ""
echo "*.node files:"
find ${{ steps.napi-info.outputs.binding-path }} -name "*.node" -type f -exec ls -la {} \; || echo "No .node files found"

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Enable corepack
run: corepack enable

- name: Setup pnpm
run: corepack prepare

- name: Cache pnpm dependencies
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-

- name: Install dependencies
run: pnpm install

- name: Run example - plugin
run: node build.js
working-directory: examples/plugin
26 changes: 15 additions & 11 deletions crates/binding/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
{
"name": "@rspack-template/binding",
"version": "0.0.0",
"homepage": "https://github.com/rspack-contrib/rspack-binding-template",
"bugs": {
"url": "https://github.com/rspack-contrib/rspack-binding-template/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/rspack-contrib/rspack-binding-template.git",
"directory": "crates/binding"
},
"files": [
"index.js",
"index.d.ts"
],
"scripts": {
"build": "napi build --platform"
},
Expand All @@ -12,17 +26,7 @@
"binaryName": "binding",
"targets": [
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"i686-pc-windows-msvc",
"aarch64-unknown-linux-gnu",
"aarch64-apple-darwin",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-linux-androideabi",
"armv7-unknown-linux-gnueabihf",
"aarch64-linux-android"
"aarch64-apple-darwin"
]
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@rspack-template/core",
"version": "0.0.0",
"homepage": "https://github.com/rspack-contrib/rspack-binding-template",
"bugs": {
"url": "https://github.com/rspack-contrib/rspack-binding-template/issues"
Expand All @@ -15,8 +16,7 @@
"./package.json": "./package.json"
},
"files": [
"lib",
"package.json"
"lib"
],
"scripts": {
"prepare": "husky",
Expand Down
1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
packages:
- 'crates/binding'
- 'crates/binding/npm/**'
- 'examples/plugin'
- '.'
Loading