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
24 changes: 24 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Meta-Notation Changesets

This directory contains [changesets](https://github.com/changesets/changesets) which are used to manage versions and changelogs.

## How to add a changeset

When making changes that should trigger a version bump, run:

```bash
npx changeset
```

Or manually trigger a release via GitHub Actions:
1. Go to Actions tab
2. Select "Manual Release" workflow
3. Click "Run workflow"
4. Choose version bump type (patch/minor/major)
5. Add optional description

## Changeset types

- **patch**: Bug fixes and minor changes
- **minor**: New features (backward compatible)
- **major**: Breaking changes
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
85 changes: 85 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Contributing to Meta-Notation

Thank you for your interest in contributing to meta-notation!

## Development Setup

### JavaScript/TypeScript

```bash
cd js
npm install
npm run build
npm test
```

### Rust

```bash
cd rust
cargo build
cargo test
```

## Running Tests

### JavaScript
```bash
cd js
npm test # Run all tests
npm run build # Build the project
```

### Rust
```bash
cd rust
cargo test # Run all tests
cargo test --doc # Run doc tests
cargo fmt # Format code
cargo clippy # Lint code
```

## Continuous Integration

We use GitHub Actions for CI/CD:

- **CI/CD**: Runs linting and tests on multiple platforms
- **Manual Release**: Trigger releases via GitHub Actions
- **Auto-publish**: Automatic publishing to npm and crates.io on release

## Making Changes

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Ensure tests pass: `npm test` (JS) and `cargo test` (Rust)
5. Run formatters: `cargo fmt` (Rust)
6. Submit a pull request

## Releasing

We use [changesets](https://github.com/changesets/changesets) for version management.

### Manual Release
1. Go to GitHub Actions
2. Select "Manual Release" workflow
3. Choose version bump type (patch/minor/major)
4. Review and merge the created PR
5. The release will be automated

## Code Style

### JavaScript/TypeScript
- Use test-anywhere for tests
- Follow existing code patterns
- Keep tests in `tests/` folder

### Rust
- Follow standard Rust conventions
- Run `cargo fmt` before committing
- Run `cargo clippy` to catch common mistakes
- Add tests for new functionality

## License

By contributing, you agree to license your contribution under the Unlicense (public domain).
157 changes: 157 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: CI/CD

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# Lint and format check for JavaScript/TypeScript
lint-js:
name: Lint JavaScript/TypeScript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: js/package-lock.json

- name: Install dependencies
working-directory: js
run: npm ci

- name: Build
working-directory: js
run: npm run build

# Lint and format check for Rust
lint-rust:
name: Lint Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy

- name: Format check
working-directory: rust
run: cargo fmt --check

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

# Test JavaScript/TypeScript implementation
test-js:
name: Test JS (${{ matrix.os }}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ['18.x', '20.x', '22.x']
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache-dependency-path: js/package-lock.json

- name: Install dependencies
working-directory: js
run: npm ci

- name: Build
working-directory: js
run: npm run build

- name: Run tests
working-directory: js
run: npm test

# Test Rust implementation
test-rust:
name: Test Rust (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Build
working-directory: rust
run: cargo build --verbose

- name: Run tests
working-directory: rust
run: cargo test --verbose

- name: Run doc tests
working-directory: rust
run: cargo test --doc

# Release workflow (only on main branch after successful tests)
release:
name: Release
needs: [lint-js, lint-rust, test-js, test-rust]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: js/package-lock.json

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install JS dependencies
working-directory: js
run: npm ci

- name: Build JS
working-directory: js
run: npm run build

- name: Build Rust
working-directory: rust
run: cargo build --release

- name: Create Release PR
id: changesets
uses: changesets/action@v1
with:
title: "🚀 Release new version"
commit: "🤖 Version bump"
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67 changes: 67 additions & 0 deletions .github/workflows/manual-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Manual Release

on:
workflow_dispatch:
inputs:
bump_type:
description: 'Version bump type'
required: true
type: choice
options:
- patch
- minor
- major
description:
description: 'Release description (optional)'
required: false
type: string

permissions:
contents: write
pull-requests: write

jobs:
create-changeset:
name: Create Release Changeset
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Create changeset file
run: |
mkdir -p .changeset
cat > .changeset/manual-release-${{ github.run_id }}.md << EOF
---
"meta-notation": ${{ github.event.inputs.bump_type }}
---

${{ github.event.inputs.description || 'Manual release triggered' }}
EOF

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "chore: prepare ${{ github.event.inputs.bump_type }} release"
branch: changeset-release/${{ github.run_id }}
title: "🚀 Release: ${{ github.event.inputs.bump_type }} version bump"
body: |
## Manual Release Request

**Triggered by:** @${{ github.actor }}
**Release type:** ${{ github.event.inputs.bump_type }}
**Description:** ${{ github.event.inputs.description || 'No description provided' }}

This PR was automatically created to prepare a new release.

### Next Steps
1. Review the changeset file
2. Merge this PR to main
3. The automated release workflow will handle versioning and publishing
labels: release
35 changes: 35 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish to npm

on:
release:
types: [published]

jobs:
publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: js/package-lock.json

- name: Install dependencies
working-directory: js
run: npm ci

- name: Build
working-directory: js
run: npm run build

- name: Publish to npm
working-directory: js
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
continue-on-error: true
Loading