fix: resolve CI formatting and clippy issues #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| 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/ | |
| - name: Run Playwright tests | |
| 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!" |