diff --git a/.github/workflows/publish-npm-github.yml b/.github/workflows/publish-npm-github.yml index dac495b..8e6371f 100644 --- a/.github/workflows/publish-npm-github.yml +++ b/.github/workflows/publish-npm-github.yml @@ -16,6 +16,11 @@ on: JSON array of package scopes/names to publish (e.g., '["com.onesignal.unity.core", "com.onesignal.unity.android"]') If empty, publishes the root package.json default: "[]" + toolchain: + required: false + type: string + description: Toolchain to use for install & build ("bun" or "vite-plus") + default: bun secrets: GH_PUSH_TOKEN: required: false @@ -39,19 +44,29 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} ref: ${{ inputs.branch }} - # Bun for installing dependencies and building - name: Setup Bun + if: inputs.toolchain == 'bun' uses: oven-sh/setup-bun@v2 with: bun-version: latest - - name: Install & Build + - name: Setup Vite+ + if: inputs.toolchain == 'vite-plus' + uses: voidzero-dev/setup-vp@v1 + with: + cache: yes + run-install: true + + - name: Install & Build (Bun) + if: inputs.toolchain == 'bun' run: | bun install --frozen-lockfile bun run build - # Can't use Bun yet for publishing to NPM via OIDC, so we use Node.js - # for publishing + - name: Build (Vite+) + if: inputs.toolchain == 'vite-plus' + run: vp pack + - name: Setup Node uses: actions/setup-node@v6 with: @@ -61,8 +76,8 @@ jobs: - name: Get version id: get_version run: | - CURRENT_VERSION=$(bun -e "console.log(require('./package.json').version)") - PACKAGE_NAME=$(bun -e "console.log(require('./package.json').name)") + CURRENT_VERSION=$(node -e "console.log(require('./package.json').version)") + PACKAGE_NAME=$(node -e "console.log(require('./package.json').name)") if git rev-parse "$CURRENT_VERSION" >/dev/null 2>&1; then echo "Tag $CURRENT_VERSION already exists, nothing to do" exit 0 diff --git a/.github/workflows/wrapper-js-ci.yml b/.github/workflows/wrapper-js-ci.yml index 935150f..7cfe231 100644 --- a/.github/workflows/wrapper-js-ci.yml +++ b/.github/workflows/wrapper-js-ci.yml @@ -1,5 +1,5 @@ # CI workflow for JavaScript-based wrapper SDKs (Cordova-Ionic/React Native) -# Sets up JDK, Homebrew, Clang, Bun, then runs lint and tests +# Sets up JDK, Clang, and either Bun or Vite+ (vp), then runs lint and tests name: Wrapper JS CI on: @@ -10,10 +10,15 @@ on: type: string description: Java version to use default: "17" + toolchain: + required: false + type: string + description: Toolchain to use for install, lint & test ("bun" or "vite-plus") + default: bun bun_version: required: false type: string - description: Bun version to use + description: Bun version to use (only when toolchain is "bun") default: latest jobs: @@ -21,9 +26,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - - name: Set up JDK 17 + - name: Set up JDK uses: actions/setup-java@v4 with: java-version: ${{ inputs.java_version }} @@ -33,15 +38,34 @@ jobs: uses: OneSignal/actions/.github/actions/setup-clang@main - name: Set up Bun + if: inputs.toolchain == 'bun' uses: oven-sh/setup-bun@v2 with: bun-version: ${{ inputs.bun_version }} - - name: Install + - name: Install (Bun) + if: inputs.toolchain == 'bun' run: bun install --frozen-lockfile - - name: Linting + - name: Set up Vite+ + if: inputs.toolchain == 'vite-plus' + uses: voidzero-dev/setup-vp@v1 + with: + cache: yes + run-install: true + + - name: Linting (Bun) + if: inputs.toolchain == 'bun' run: bun run lint - - name: Tests + - name: Linting (Vite+) + if: inputs.toolchain == 'vite-plus' + run: vp run lint + + - name: Tests (Bun) + if: inputs.toolchain == 'bun' run: bun run test:coverage + + - name: Tests (Vite+) + if: inputs.toolchain == 'vite-plus' + run: vp run test