Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update release flow to use changesets. #577

Merged
merged 25 commits into from Mar 14, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/config.json
@@ -0,0 +1,17 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"access": "public",
"baseBranch": "main",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [["rolldown", "@rolldown/wasm-binding"]],
"ignore": [
"bench",
"rolldown-docs",
"rolldown-playground",
"rollup-tests",
"scripts"
],
"linked": [],
"updateInternalDependencies": "minor"
}
29 changes: 23 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -96,9 +96,7 @@ jobs:
cache-base: main

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.15.4
uses: pnpm/action-setup@v3

- name: Install node
uses: actions/setup-node@v4
Expand All @@ -125,9 +123,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.15.4
uses: pnpm/action-setup@v3

- name: Install node
uses: actions/setup-node@v4
Expand All @@ -149,3 +145,24 @@ jobs:

- name: Lint Spell
run: pnpm lint-spell

# changesets:
# name: Changesets Status
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4

# - name: Install pnpm
# uses: pnpm/action-setup@v3

# - name: Install node
# uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: pnpm

# - name: Install dependencies
# run: pnpm install

# - name: Check for changeset
# run: pnpm changeset status --since=main
4 changes: 1 addition & 3 deletions .github/workflows/codspeed.yml
Expand Up @@ -39,9 +39,7 @@ jobs:
cache-target: release

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.15.4
uses: pnpm/action-setup@v3

- name: Install node
uses: actions/setup-node@v4
Expand Down
120 changes: 57 additions & 63 deletions .github/workflows/release.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
include:
- os: macos-latest
target: x86_64-apple-darwin
build: pnpm build-binding:release
build: pnpm build-binding:release --target x86_64-apple-darwin

- os: macos-latest
target: aarch64-apple-darwin
Expand All @@ -26,78 +26,66 @@ jobs:
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
export CARGO_BUILD_TARGET=aarch64-apple-darwin;
pnpm build-binding:release
pnpm build-binding:release --target aarch64-apple-darwin

- os: windows-latest
target: x86_64-pc-windows-msvc
build: pnpm build-binding:release
build: pnpm build-binding:release --target x86_64-pc-windows-msvc

- os: windows-latest
target: i686-pc-windows-msvc
build: |
export CARGO_BUILD_TARGET=i686-pc-windows-msvc;
pnpm build-binding:release
pnpm build-binding:release --target i686-pc-windows-msvc

- os: windows-latest
target: aarch64-pc-windows-msvc
build: |
export CARGO_BUILD_TARGET=aarch64-pc-windows-msvc;
pnpm build-binding:release
pnpm build-binding:release --target aarch64-pc-windows-msvc

- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |-
set -e;
build: |
export CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu;
pnpm build-binding:release
export CC=clang;
pnpm build-binding:release --target x86_64-unknown-linux-gnu --use-napi-cross

- os: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: pnpm build-binding:release
build: pnpm build-binding:release --target x86_64-unknown-linux-musl -x

- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |-
set -e;
build: |
export CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu;
rustup target add aarch64-unknown-linux-gnu;
pnpm build-binding:release
export CC=clang;
pnpm build-binding:release --use-napi-cross --target aarch64-unknown-linux-gnu

- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
build: |
sudo apt-get update;
sudo apt-get install gcc-arm-linux-gnueabihf -y;
export CARGO_BUILD_TARGET=armv7-unknown-linux-gnueabihf;
pnpm build-binding:release --use-napi-cross

# pnpm build-binding:release --zig --zig-link-only
# trigger CI
export CC=clang;
pnpm build-binding:release --target armv7-unknown-linux-gnueabihf --use-napi-cross

- os: ubuntu-latest
target: aarch64-linux-android
build: |
export CARGO_BUILD_TARGET=aarch64-linux-android;
pnpm build-binding:release
pnpm build-binding:release --target aarch64-linux-android

- os: ubuntu-latest
target: armv7-linux-androideabi
build: |
export CARGO_BUILD_TARGET=armv7-linux-androideabi;
pnpm build-binding:release
pnpm build-binding:release --target armv7-linux-androideabi

- os: ubuntu-latest
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |-
set -e;
rustup target add aarch64-unknown-linux-musl;
build: |
export CARGO_BUILD_TARGET=aarch64-unknown-linux-musl;
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-musl-gcc;
pnpm build-binding:release
pnpm build-binding:release -x --target aarch64-unknown-linux-musl
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -112,10 +100,15 @@ jobs:
run: rustup target add ${{ matrix.target }}

- uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }}
if: ${{ contains(matrix.target, 'musl') }}
with:
version: 0.11.0

- uses: taiki-e/install-action@v2
if: ${{ contains(matrix.target, 'musl') }}
with:
tool: cargo-zigbuild

# https://github.com/nodejs/node-gyp/issues/2869
- name: Setup python
run: pip install setuptools
Expand All @@ -132,18 +125,8 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Build Binding in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.docker }}
with:
image: ${{ matrix.docker }}
run: ${{ matrix.build }}
options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build'
shell: bash

- name: Build Binding
run: ${{ matrix.build }}
if: ${{ !matrix.docker }}
shell: bash

- name: Upload Binding Artifact
Expand Down Expand Up @@ -173,7 +156,7 @@ jobs:
run: pnpm install

- name: Build Node Packages
run: pnpm build:release
run: pnpm --filter rolldown build:release:ci

- name: Upload Node Artifact
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -226,6 +209,9 @@ jobs:
- os: macos-latest
target: x86_64-apple-darwin

- os: macos-14
target: aarch64-apple-darwin

- os: windows-latest
target: x86_64-pc-windows-msvc

Expand All @@ -249,23 +235,27 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Download Binding Artifacts
- name: Download Node Artifacts
uses: actions/download-artifact@v4
with:
path: crates/rolldown_binding/artifacts

- name: Move Binding Artifacts
run: pnpm --filter rolldown artifacts
path: packages/rolldown/dist
name: node-artifact

- name: List packages
run: ls -R ./crates/rolldown_binding
shell: bash
- name: Download Binding Artifacts
uses: actions/download-artifact@v4
with:
path: packages/rolldown/src
name: bindings-${{ matrix.target }}

- name: Download Node Artifacts
- name: Download Binding Artifacts
uses: actions/download-artifact@v4
with:
path: packages/rolldown/dist
name: node-artifact
name: bindings-${{ matrix.target }}

- name: List rolldown dist
run: ls -R ./packages/rolldown
shell: bash

- name: Node Test
run: pnpm test
Expand Down Expand Up @@ -301,13 +291,13 @@ jobs:
- name: Download Binding Artifacts
uses: actions/download-artifact@v4
with:
path: crates/rolldown_binding/artifacts
path: packages/rolldown/artifacts

- name: Move Binding Artifacts
run: pnpm --filter rolldown artifacts

- name: List packages
run: ls -R ./crates/rolldown_binding
run: ls -R ./packages/rolldown/npm
shell: bash

- name: Download Node Artifacts
Expand All @@ -316,12 +306,16 @@ jobs:
path: packages/rolldown/dist
name: node-artifact

# - name: Publish
# run: |
# find ./packages/ -type d -maxdepth 1 -exec cp LICENSE {} \;
# find ./packages/ -type d -maxdepth 1 -exec cp THIRD-PARTY-LICENSE {} \;
# echo "//registry.npmjs.org/:_authToken=$ROLLDOWN_NPM_TOKEN" >> ~/.npmrc
# pnpm lerna publish from-package --no-private --no-git-reset --yes
# env:
# ROLLDOWN_NPM_TOKEN: ${{ secrets.ROLLDOWN_NPM_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish
run: |
find ./packages/ -type d -maxdepth 1 -exec cp LICENSE {} \;
find ./packages/ -type d -maxdepth 1 -exec cp THIRD-PARTY-LICENSE {} \;
echo "//registry.npmjs.org/:_authToken=$ROLLDOWN_NPM_TOKEN" >> ~/.npmrc
pnpm changeset version
git add --all
git commit -m "chore: Release"
pnpm changeset publish
git push --follow-tags
env:
NPM_TOKEN: ${{ secrets.ROLLDOWN_NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion .vscode/settings.json
Expand Up @@ -30,5 +30,9 @@
"fileMatch": ["test.config.json"],
"url": "./crates/rolldown_testing/test.config.scheme.json"
}
]
],
"search.exclude": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't know about y'all, but I hate these folders showing up in search.

"rollup": true,
"temp": true
}
}
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -37,7 +37,7 @@ rest_pat_in_fully_bound_structs = "deny"
unnecessary_safety_comment = "deny"

# --- pedantic #https://doc.rust-lang.org/clippy/usage.html#clippypedantic
# To write the best rust code, pedantic group is enabled by default.
# To write the best rust code, pedantic group is enabled by default.
pedantic = { level = "deny", priority = -1 }

# Wizards, naming is too hard.
Expand Down
17 changes: 16 additions & 1 deletion justfile
Expand Up @@ -70,7 +70,7 @@ test-node:
fmt:
just fmt-rust
just fmt-lint

fmt-rust:
cargo fmt --all -- --emit=files
taplo fmt
Expand Down Expand Up @@ -101,3 +101,18 @@ setup-bench:

bench:
cargo bench -p bench

# RELEASING

change:
pnpm changeset add

no-change:
pnpm changeset add --empty

version:
pnpm changeset version

publish:
pnpm changeset publish
git push --follow-tags
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,5 @@
{
"name": "monorepo",
"version": "0.0.5",
"description": "Rollup in Rust",
"private": true,
"packageManager": "[email protected]",
Expand Down Expand Up @@ -36,6 +35,7 @@
},
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@ls-lint/ls-lint": "^2.2.2",
"@taplo/cli": "^0.7.0",
"@types/node": "^20.11.26",
Expand Down
3 changes: 2 additions & 1 deletion packages/rolldown/build.config.ts
Expand Up @@ -18,7 +18,8 @@ export default defineBuildConfig({
const binaryFiles = globSync('./src/rolldown-binding.*.node', {
absolute: true,
})
if (binaryFiles.length === 0) {
// Binary build is on the separate step on CI
if (!process.env.CI && binaryFiles.length === 0) {
throw new Error('No binary files found')
}
// Move the binary file to dist
Expand Down
1 change: 1 addition & 0 deletions packages/rolldown/package.json
Expand Up @@ -40,6 +40,7 @@
"build-node": "unbuild",
"build": "pnpm build-binding && pnpm build-node && pnpm format-generated-binding-files",
"build:release": "pnpm build-binding:release && pnpm build-node && pnpm format-generated-binding-files",
"build:release:ci": "pnpm build-node && pnpm format-generated-binding-files",
"# Scrips for checking #": "_",
"test": "vitest run",
"test:update": "vitest run -u",
Expand Down