Skip to content
Open
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
159 changes: 159 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: CI

on:
push:
branches: [ main, claude/** ]
pull_request:
branches: [ main ]

jobs:
rust-tests:
name: Rust Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Check formatting
run: cargo fmt -- --check

- name: Run clippy
run: cargo clippy -- -D warnings

- name: Run Rust tests
run: cargo test --all-targets

build-wasm:
name: Build WASM
runs-on: ubuntu-latest
needs: rust-tests
steps:
- uses: actions/checkout@v4

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

- name: Add WASM target
run: rustup target add wasm32-unknown-unknown

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build WASM package
run: wasm-pack build --target web --out-dir pkg

- name: Upload WASM artifacts
uses: actions/upload-artifact@v4
with:
name: wasm-build
path: pkg/

e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
needs: build-wasm
strategy:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
steps:
- uses: actions/checkout@v4

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

- name: Download WASM artifacts
uses: actions/download-artifact@v4
with:
name: wasm-build
path: pkg/

- name: Install dependencies
run: npm ci

- name: Install Playwright Browsers
run: npx playwright install --with-deps ${{ matrix.browser }}

- name: Copy WASM files to public
run: |
mkdir -p public/wasm public/js
cp pkg/terraphim_editor_bg.wasm public/wasm/
cp pkg/terraphim_editor.js public/js/
ls -la public/wasm/ public/js/terraphim_editor.js

- name: Verify WASM files
run: |
test -f public/wasm/terraphim_editor_bg.wasm || (echo "WASM file missing!" && exit 1)
test -f public/js/terraphim_editor.js || (echo "JS file missing!" && exit 1)
echo "✓ WASM files present"

- name: Run Playwright tests
env:
CI: true
run: npx playwright test --project=${{ matrix.browser }}

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.browser }}
path: playwright-report/
retention-days: 30

build-package:
name: Build Distribution Package
runs-on: ubuntu-latest
needs: build-wasm
steps:
- uses: actions/checkout@v4

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

- name: Download WASM artifacts
uses: actions/download-artifact@v4
with:
name: wasm-build
path: pkg/

- name: Install dependencies
run: npm ci

- name: Copy WASM files
run: |
mkdir -p public/wasm public/js
cp pkg/terraphim_editor_bg.wasm public/wasm/
cp pkg/terraphim_editor.js public/js/

- name: Build package
run: npm run build

- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: dist-package
path: dist/

all-tests-passed:
name: All Tests Passed
runs-on: ubuntu-latest
needs: [rust-tests, build-wasm, e2e-tests, build-package]
steps:
- name: Success
run: echo "All tests passed successfully!"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ desktop/src-tauri/Cargo.lock
docs/src/thesaurus.json
docs/src/*.json
dist/

# Playwright test artifacts
test-results/
playwright-report/
playwright/.cache/
Loading
Loading