Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,61 @@ jobs:
name: bindings-x86_64-unknown-freebsd
path: ${{ env.OXIDE_LOCATION }}/*.node

build-ohos:
name: Build aarch64-unknown-linux-ohos (oxide)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6
with:
version: ${{ env.PNPM_VERSION }}

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: ${{ env.NODE_VERSION }}
package-manager-cache: false

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

- name: Setup rust target
run: rustup target add aarch64-unknown-linux-ohos

- name: Setup OpenHarmony SDK
uses: Boshen/setup-ohos-sdk@edb865a89a712f1f15dbad932dfa9cfce849d95c # v1.0.0

- name: Configure OHOS linker
run: |
echo "${OHOS_SDK_NATIVE}/llvm/bin" >> $GITHUB_PATH
cat > /tmp/aarch64-linux-ohos-clang <<'WRAPPER'
#!/bin/sh
exec ${OHOS_SDK_NATIVE}/llvm/bin/clang --target=aarch64-linux-ohos "$@"
WRAPPER
chmod +x /tmp/aarch64-linux-ohos-clang

- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile --filter=!./playgrounds/*
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

- name: Build release
run: pnpm run --filter ${{ env.OXIDE_LOCATION }} build:platform --target=aarch64-unknown-linux-ohos
env:
RUST_TARGET: aarch64-unknown-linux-ohos
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_OHOS_LINKER: /tmp/aarch64-linux-ohos-clang
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_OHOS_RUSTFLAGS: -C link-arg=-fuse-ld=lld -C link-arg=-lm

- name: Strip debug symbols
run: ${OHOS_SDK_NATIVE}/llvm/bin/llvm-strip ${{ env.OXIDE_LOCATION }}/*.node

- name: Upload artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: bindings-aarch64-unknown-linux-ohos
path: ${{ env.OXIDE_LOCATION }}/*.node

release:
runs-on: macos-14
timeout-minutes: 15
Expand All @@ -212,6 +267,7 @@ jobs:
needs:
- build
- build-freebsd
- build-ohos

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Expand Down Expand Up @@ -277,6 +333,7 @@ jobs:
cp bindings-x86_64-unknown-linux-gnu/* ./npm/linux-x64-gnu/
cp bindings-x86_64-unknown-linux-musl/* ./npm/linux-x64-musl/
cp bindings-x86_64-unknown-freebsd/* ./npm/freebsd-x64/
cp bindings-aarch64-unknown-linux-ohos/* ./npm/openharmony-arm64/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Rename OHOS artifact

This copy puts the OHOS build output into npm/openharmony-arm64/ without changing the filename. The package declares tailwindcss-oxide.openharmony-arm64.node as its entry point, while the napi build --platform --target=aarch64-unknown-linux-ohos output is target-derived. If that output keeps the OHOS target name, the published package can contain a .node file that does not match its main, so require('@tailwindcss/oxide-openharmony-arm64') fails with MODULE_NOT_FOUND even though the package installed successfully. Please rename the copied artifact to the filename declared by the platform package, or update the package metadata to match the actual build output.


- name: 'Version based on commit: ${{ env.INSIDERS_VERSION }}'
if: env.RELEASE_KIND == 'insiders'
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/test-ohos-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Test OHOS build

on:
push:
branches: [feat/ohos-support]
workflow_dispatch:

env:
NODE_VERSION: 24
PNPM_VERSION: '9.6.0'
OXIDE_LOCATION: ./crates/node

jobs:
build-ohos:
name: Build aarch64-unknown-linux-ohos (oxide)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Pin actions to commit SHAs and disable credential persistence.

actions/checkout@v4, pnpm/action-setup@v4, actions/setup-node@v4, and dtolnay/rust-toolchain@stable are referenced by mutable tags, which is inconsistent with the SHA-pinned Boshen/setup-ohos-sdk on line 37 and the repo's pinning policy. Also set persist-credentials: false on the checkout since this job only builds and does not push.

🔒 Proposed fix
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@<commit-sha> # v4
+        with:
+          persist-credentials: false

Apply the same SHA pinning to lines 21, 26, and 31.

🧰 Tools
🪛 zizmor (1.26.1)

[warning] 19-19: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 19-19: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 21-21: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 26-26: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 31-31: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test-ohos-build.yml around lines 19 - 31, The workflow job
uses mutable action tags in the checkout/setup steps, so update the
`actions/checkout`, `pnpm/action-setup`, `actions/setup-node`, and
`dtolnay/rust-toolchain` references to pinned commit SHAs to match the repo’s
pinning policy. Also update the `actions/checkout` step to disable credential
persistence with `persist-credentials: false` since this job only builds; keep
the changes localized to the existing checkout, pnpm setup, node setup, and Rust
toolchain steps.

Source: Linters/SAST tools


- name: Setup rust target
run: rustup target add aarch64-unknown-linux-ohos

- name: Setup OpenHarmony SDK
uses: Boshen/setup-ohos-sdk@edb865a89a712f1f15dbad932dfa9cfce849d95c # v1.0.0

- name: Configure OHOS linker
run: |
echo "${OHOS_SDK_NATIVE}/llvm/bin" >> $GITHUB_PATH
cat > /tmp/aarch64-linux-ohos-clang <<'WRAPPER'
#!/bin/sh
exec ${OHOS_SDK_NATIVE}/llvm/bin/clang --target=aarch64-linux-ohos "$@"
WRAPPER
chmod +x /tmp/aarch64-linux-ohos-clang

- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile --filter=!./playgrounds/*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Remove --ignore-scripts from the install step.

In this repo's setup, Bun relies on lifecycle scripts during installation, so --ignore-scripts breaks the Bun-related setup. Keep --frozen-lockfile (and the playgrounds filter), but drop --ignore-scripts.

🔧 Proposed fix
-        run: pnpm install --ignore-scripts --frozen-lockfile --filter=!./playgrounds/*
+        run: pnpm install --frozen-lockfile --filter=!./playgrounds/*

Based on learnings: do not run pnpm install with --ignore-scripts in this repo's CI/release workflows because Bun relies on lifecycle scripts during installation; the only safe flag to enforce is --frozen-lockfile.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: pnpm install --ignore-scripts --frozen-lockfile --filter=!./playgrounds/*
run: pnpm install --frozen-lockfile --filter=!./playgrounds/*
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test-ohos-build.yml at line 49, Remove the
--ignore-scripts flag from the pnpm install step in the test-ohos-build workflow
so Bun lifecycle scripts can run during installation; keep the existing
--frozen-lockfile and playgrounds filter arguments in the install command, and
update the workflow step that uses pnpm install accordingly.

Source: Learnings


- name: Build release
run: pnpm run --filter ${{ env.OXIDE_LOCATION }} build:platform --target=aarch64-unknown-linux-ohos
env:
RUST_TARGET: aarch64-unknown-linux-ohos
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_OHOS_LINKER: /tmp/aarch64-linux-ohos-clang
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_OHOS_RUSTFLAGS: -C link-arg=-fuse-ld=lld -C link-arg=-lm

- name: Strip debug symbols
run: ${OHOS_SDK_NATIVE}/llvm/bin/llvm-strip ${{ env.OXIDE_LOCATION }}/*.node

- name: List artifacts
run: ls -lh ${{ env.OXIDE_LOCATION }}/*.node
27 changes: 27 additions & 0 deletions crates/node/npm/openharmony-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@tailwindcss/oxide-openharmony-arm64",
"version": "4.3.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Sync package version
This new native package is picked up by the recursive publish step, but it is not in the hardcoded oxide package list that the release workflow versions before publishing. On the next release or insiders publish, this package can stay at 4.3.1 while @tailwindcss/oxide points at the new release version. The publish can then fail because 4.3.1 already exists, or OpenHarmony users can get a platform package whose version no longer matches the parent optional dependency set. Please add crates/node/npm/openharmony-arm64 to the same version sync list as the other native packages.

"repository": {
"type": "git",
"url": "git+https://github.com/tailwindlabs/tailwindcss.git",
"directory": "crates/node/npm/openharmony-arm64"
},
"os": [
"openharmony"
],
"cpu": [
"arm64"
],
"main": "tailwindcss-oxide.openharmony-arm64.node",
"files": [
"tailwindcss-oxide.openharmony-arm64.node"
],
"publishConfig": {
"provenance": true,
"access": "public"
},
"license": "MIT",
"engines": {
"node": ">= 20"
}
}
2 changes: 2 additions & 0 deletions crates/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"targets": [
"armv7-linux-androideabi",
"aarch64-linux-android",
"aarch64-unknown-linux-ohos",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Generated Loader Can Miss OHOS

This relies on the generated loader mapping aarch64-unknown-linux-ohos to the openharmony-arm64 package at publish time, but no checked-in loader change or release-step verification pins that behavior here. If the generator does not emit an openharmony branch for the runtime platform, OpenHarmony installs can receive the new optional package but still try the wrong native package or report that no native binary is available.

"aarch64-apple-darwin",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
Expand Down Expand Up @@ -60,6 +61,7 @@
},
"optionalDependencies": {
"@tailwindcss/oxide-android-arm64": "workspace:*",
"@tailwindcss/oxide-openharmony-arm64": "workspace:*",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Frozen Lockfile Install Fails

This adds a new workspace optional dependency, but the PR does not include a matching pnpm-lock.yaml update. The new OHOS workflow runs pnpm install --ignore-scripts --frozen-lockfile, so release builds can stop at install time before the native package is built or published.

"@tailwindcss/oxide-darwin-arm64": "workspace:*",
"@tailwindcss/oxide-darwin-x64": "workspace:*",
"@tailwindcss/oxide-freebsd-x64": "workspace:*",
Expand Down