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
53 changes: 53 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Node.js (jacsnpm)

on:
push:
branches: [ "main" ]
paths:
- 'jacsnpm/**'
- 'jacs/**' # jacsnpm depends on jacs
- '.github/workflows/nodejs.yml'
pull_request:
branches: [ "main" ]
paths:
- 'jacsnpm/**'
- 'jacs/**' # jacsnpm depends on jacs
- '.github/workflows/nodejs.yml'
workflow_dispatch: # Allows manual triggering

env:
CARGO_TERM_COLOR: always

jobs:
test-jacsnpm:
name: Test jacsnpm (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node-version: ['20']

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

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
working-directory: jacsnpm
run: npm ci || npm install

- name: Build native module
working-directory: jacsnpm
run: npm run build

- name: Run tests
working-directory: jacsnpm
run: npm test
48 changes: 48 additions & 0 deletions .github/workflows/release-crate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release crates.io

on:
push:
tags:
- 'crate/v*'

permissions:
contents: read

jobs:
verify-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract.outputs.version }}
steps:
- uses: actions/checkout@v4

- name: Extract version from tag
id: extract
run: |
TAG="${GITHUB_REF#refs/tags/crate/v}"
echo "version=$TAG" >> $GITHUB_OUTPUT

- name: Check Cargo.toml version matches tag
run: |
CARGO_VERSION=$(grep '^version = ' jacs/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
TAG_VERSION="${{ steps.extract.outputs.version }}"
echo "Cargo version: $CARGO_VERSION"
echo "Tag version: $TAG_VERSION"
if [ "$CARGO_VERSION" = "$TAG_VERSION" ]; then
echo "Version match confirmed"
else
echo "::error::Version mismatch! Cargo.toml has $CARGO_VERSION but tag is $TAG_VERSION"
exit 1
fi

publish:
needs: verify-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Publish to crates.io
working-directory: jacs
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
122 changes: 122 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Release PyPI

on:
push:
tags:
- 'pypi/v*'

permissions:
contents: read
id-token: write

jobs:
verify-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract.outputs.version }}
steps:
- uses: actions/checkout@v4

- name: Extract version from tag
id: extract
run: |
TAG="${GITHUB_REF#refs/tags/pypi/v}"
echo "version=$TAG" >> $GITHUB_OUTPUT

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Check pyproject.toml version matches tag
run: |
pip install toml
PKG_VERSION=$(python -c "import toml; print(toml.load('jacspy/pyproject.toml')['project']['version'])")
TAG_VERSION="${{ steps.extract.outputs.version }}"
echo "Package version: $PKG_VERSION"
echo "Tag version: $TAG_VERSION"
if [ "$PKG_VERSION" = "$TAG_VERSION" ]; then
echo "Version match confirmed"
else
echo "::error::Version mismatch! pyproject.toml has $PKG_VERSION but tag is $TAG_VERSION"
exit 1
fi

build-wheels:
needs: verify-version
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-13
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc

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

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}

- name: Install maturin
run: pip install maturin

- name: Build wheel
working-directory: jacspy
run: maturin build --release --target ${{ matrix.target }} --out dist

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.target }}
path: jacspy/dist/*.whl

build-sdist:
needs: verify-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install maturin
run: pip install maturin

- name: Build sdist
working-directory: jacspy
run: maturin sdist --out dist

- uses: actions/upload-artifact@v4
with:
name: sdist
path: jacspy/dist/*.tar.gz

publish:
needs: [build-wheels, build-sdist]
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
password: ${{ secrets.PYPI_API_TOKEN }}
109 changes: 109 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Release npm

on:
push:
tags:
- 'npm/v*'

permissions:
contents: write
id-token: write

jobs:
verify-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract.outputs.version }}
matches: ${{ steps.check.outputs.matches }}
steps:
- uses: actions/checkout@v4

- name: Extract version from tag
id: extract
run: |
TAG="${GITHUB_REF#refs/tags/npm/v}"
echo "version=$TAG" >> $GITHUB_OUTPUT

- name: Check package.json version matches tag
id: check
run: |
PKG_VERSION=$(node -p "require('./jacsnpm/package.json').version")
TAG_VERSION="${{ steps.extract.outputs.version }}"
echo "Package version: $PKG_VERSION"
echo "Tag version: $TAG_VERSION"
if [ "$PKG_VERSION" = "$TAG_VERSION" ]; then
echo "matches=true" >> $GITHUB_OUTPUT
else
echo "::error::Version mismatch! package.json has $PKG_VERSION but tag is $TAG_VERSION"
echo "matches=false" >> $GITHUB_OUTPUT
exit 1
fi

build:
needs: verify-version
strategy:
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-13
target: x86_64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc

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

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.target }}

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install
working-directory: jacsnpm

- name: Build native module
run: npx napi build --platform --release --target ${{ matrix.target }}
working-directory: jacsnpm

- uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
path: jacsnpm/*.node

publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
path: jacsnpm/artifacts

- name: Copy binaries
run: cp artifacts/**/*.node .
working-directory: jacsnpm

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'

- name: Publish to npm
run: npm publish --provenance
working-directory: jacsnpm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 7 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ name: Rust (jacs crate)
on:
push:
branches: [ "main" ]
paths: # Optional: Trigger only on changes within jacs/ or relevant files
- 'JACS/jacs/**'
- '.github/workflows/rust.yml'
paths:
- 'jacs/**'
- '.github/workflows/rust.yml'
pull_request:
branches: [ "main" ]
paths: # Optional: Trigger only on changes within jacs/ or relevant files
- 'JACS/jacs/**'
- '.github/workflows/rust.yml'
paths:
- 'jacs/**'
- '.github/workflows/rust.yml'
workflow_dispatch: # Allows manual triggering

env:
CARGO_TERM_COLOR: always
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"jacs",
"binding-core",
"jacsnpm",
"jacspy",
"jacs-mcp",
Expand Down
13 changes: 13 additions & 0 deletions LINES_OF_CODE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Language Files Lines Code Comments Blanks
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Go 11 3332 2464 397 471
Python 151 32677 25473 1560 5644
TypeScript 9 2407 1352 842 213
─────────────────────────────────────────────────────────────────────────────────
Rust 337 85972 70992 4926 10054
|- Markdown 238 23660 565 17413 5682
(Total) 109632 71557 22339 15736
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Total 508 148048 100846 25138 22064
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Loading
Loading