Skip to content
Draft
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 .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[target.wasm32-unknown-unknown]
rustflags = [
"-C", "opt-level=z", # Optimize for size
"-C", "panic=abort", # Use abort on panic (smaller binary)
"-C", "codegen-units=1", # Single codegen unit for better optimization
"-C", "strip=symbols", # Strip debug symbols
"-C", "link-arg=-s", # Strip symbols in linker
"-C", "link-arg=--gc-sections", # Remove unused sections
"-C", "link-arg=--no-export-dynamic", # Prevent dynamic exports
"-C", "link-arg=--import-memory", # Use imported memory (no file system access)
]
68 changes: 68 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown

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

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install

- name: Build hmlanguagetools-rs
run: cargo build --release --bin hmlanguagetools-rs --features="tools"

- name: Build WASM
run: make wasm-optimized

- name: Upload hmlanguagetools-rs binary
uses: actions/upload-artifact@v4
with:
name: hmlanguagetools-rs-linux
path: target/release/hmlanguagetools-rs

- name: Upload WASM binary
uses: actions/upload-artifact@v4
with:
name: tonytools-wasm
path: target/wasm32-unknown-unknown/release/tonytools_optimized.wasm

- name: Run Cargo tests
run: cargo test

build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

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

- name: Build hmlanguagetools-rs
run: cargo build --release --bin hmlanguagetools-rs --features="tools"

- name: Upload hmlanguagetools-rs binary
uses: actions/upload-artifact@v4
with:
name: hmlanguagetools-rs-windows
path: target/release/hmlanguagetools-rs.exe
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

Expand All @@ -19,11 +15,15 @@ Cargo.lock
*.DLGE
*.CLNG
*.json
!package.json
*.DITL
*.tga
*.text
*.texd
*.tony
*.tonymeta
*.png
*.dds
*.dds

.yarn
node_modules
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
Loading