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
137 changes: 137 additions & 0 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: WebAssembly CI

on:
push:
branches:
- main
- issue-*
paths:
- '.github/workflows/wasm.yml'
- 'Cargo.lock'
- 'Cargo.toml'
- 'package-lock.json'
- 'package.json'
- 'rust/**'
- 'src/**'
- 'tests/**'
- 'web/**'
pull_request:
branches:
- main
paths:
- '.github/workflows/wasm.yml'
- 'Cargo.lock'
- 'Cargo.toml'
- 'package-lock.json'
- 'package.json'
- 'rust/**'
- 'src/**'
- 'tests/**'
- 'web/**'

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

permissions:
contents: read

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Install wasm-pack
run: cargo install wasm-pack --version 0.14.0 --locked

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

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
rust/target
key: ${{ runner.os }}-wasm-cargo-${{ hashFiles('Cargo.lock', 'rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-wasm-cargo-

- name: Install npm dependencies
run: npm ci

- name: Test Rust CLI core
run: cargo test --manifest-path rust/Cargo.toml --all-features

- name: Test WebAssembly wrapper
run: npm run test:wasm

- name: Build React WebAssembly app
run: npm run build

- name: Upload built app
uses: actions/upload-artifact@v4
with:
name: link-cli-web
path: dist/

deploy:
name: Deploy GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- uses: actions/checkout@v4

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

- name: Install wasm-pack
run: cargo install wasm-pack --version 0.14.0 --locked

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

- name: Install npm dependencies
run: npm ci

- name: Build GitHub Pages app
run: npm run build:pages

- name: Configure Pages
uses: actions/configure-pages@v5

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist/

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,19 @@ db.links
db.names.links

# Rust build artifacts
rust/target/
target/
rust/target/

# JavaScript and WebAssembly build artifacts
node_modules/
dist/
pkg/
pkg-node/
pkg-bundler/
web/pkg/

# Local AI investigation artifacts
ci-logs/
gh-data/
experiments/
.playwright-mcp/
Loading
Loading