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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: cargo
directory: /rust
schedule:
interval: monthly

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,44 @@ jobs:
- name: Test (Windows)
if: matrix.os == 'windows-latest'
run: ctest -C ${{ matrix.cmake_config }} --output-on-failure --test-dir build

rust:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
toolchain: stable
- os: ubuntu-22.04
toolchain: nightly
- os: ubuntu-22.04-arm
toolchain: stable
- os: macos-14
toolchain: stable
- os: macos-15
toolchain: stable
- os: windows-latest
toolchain: stable

Choose a reason for hiding this comment

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

@dsherret @bartlomieju
Is it better to test on windows-11-arm?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably fine.

name: Rust ${{ matrix.toolchain }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy

- name: Clippy
working-directory: rust
run: cargo clippy -- -D warnings

- name: Test
working-directory: rust
run: cargo test

- name: Test (no default features)
working-directory: rust
run: cargo test --no-default-features
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,41 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ needs.release-please.outputs.release_tag }}

publish-rust:
needs: [release-please, create-release]
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
permissions:
contents: write

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

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

- name: Build and test (populates rust/deps from source)
working-directory: rust
run: cargo test

- name: Commit rust/deps if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add rust/deps/
if git diff --cached --quiet; then
echo "rust/deps is up to date"
else
git commit -m "chore: update rust/deps vendored sources"
git push
fi

- name: Publish to crates.io
working-directory: rust
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3 changes: 2 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"release-type": "simple",
"extra-files": [
"CMakeLists.txt",
"include/merve/version.h"
"include/merve/version.h",
"rust/Cargo.toml"
]
}
}
Expand Down
1 change: 1 addition & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
141 changes: 141 additions & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "merve"
version = "1.0.1" # x-release-please-version
edition = "2024"
rust-version = "1.85"
authors = ["Yagiz Nizipli <yagiz@nizipli.com>"]
license = "Apache-2.0 OR MIT"
description = "A fast C++ lexer for extracting named exports from CommonJS modules"
repository = "https://github.com/nodejs/merve"
categories = ["parsing", "development-tools"]
keywords = ["commonjs", "cjs", "exports", "lexer", "javascript"]
include = [
"src/**/*.rs",
"deps/**/*.cpp",
"deps/**/*.h",
"wasi_to_unknown.cpp",
"build.rs",
"Cargo.toml",
"LICENSE-*",
"README.md",
]

[features]
default = ["std"]
# pass `cpp_set_stdlib("c++")` to `cc`
libcpp = []
# enable allocations
std = []

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]

[build-dependencies]
cc = { version = "1.1", features = ["parallel"] }
link_args = "0.6"
regex = { version = "1.11", features = [] }
Loading
Loading