DIGIT-2257 Implement web platform channel #41
Workflow file for this run
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: Web Integration Tests | ||
| on: | ||
| push: | ||
| branches: | ||
| - '**' | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
| workflow_dispatch: | ||
| jobs: | ||
| web_tests: | ||
| name: Web Tests (WebAssembly) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| strategy: | ||
| matrix: | ||
| flutter_version: [3.19.0, 3.24.0] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| - name: Setup Flutter | ||
| uses: subosito/flutter-action@v2 | ||
| with: | ||
| flutter-version: ${{ matrix.flutter_version }} | ||
| channel: stable | ||
| cache: true | ||
| - name: Install system dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y emscripten | ||
| - name: Install Chrome for Web testing | ||
| uses: browser-actions/setup-chrome@v1 | ||
| with: | ||
| chrome-version: stable | ||
| - name: Generate Web Assets | ||
| run: | | ||
| cd parsec_web | ||
| dart bin/generate.dart | ||
| - name: Upload WASM artifacts | ||
| if: ${{ matrix.flutter_version == '3.24.0' }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: parsec-web-wasm | ||
| path: | | ||
| parsec_web/lib/parsec-web/wasm/ | ||
| retention-days: 3 | ||
| - name: Get Flutter dependencies | ||
| run: | | ||
| cd parsec_platform_interface && flutter pub get | ||
| cd ../parsec_web && flutter pub get | ||
| cd ../parsec && flutter pub get | ||
| - name: Analyze parsec_web package | ||
| run: | | ||
| cd parsec_web | ||
| flutter analyze --no-fatal-infos | ||
| - name: Analyze main parsec package | ||
| run: | | ||
| cd parsec | ||
| flutter analyze --no-fatal-infos | ||
| - name: Run parsec_web JavaScript tests (Node.js) | ||
| run: | | ||
| cd parsec_web/lib/parsec-web | ||
| npm install | ||
| npm test | ||
| - name: Run Flutter Web integration tests | ||
| run: | | ||
| cd parsec | ||
| # Backup original pubspec.yaml for publication | ||
| cp pubspec.yaml pubspec.yaml.backup | ||
| # Add dependency overrides to use local packages with WASM files | ||
| cat >> pubspec.yaml << 'EOF' | ||
| dependency_overrides: | ||
| # Use local packages for CI testing with WASM files | ||
| parsec_platform_interface: | ||
| path: ../parsec_platform_interface | ||
| parsec_web: | ||
| path: ../parsec_web | ||
| parsec_android: | ||
| path: ../parsec_android | ||
| parsec_linux: | ||
| path: ../parsec_linux | ||
| parsec_windows: | ||
| path: ../parsec_windows | ||
| EOF | ||
| # Get dependencies with overrides | ||
| flutter pub get | ||
| # Run web tests with local packages | ||
| flutter test --platform chrome test/parsec_test.dart | ||
| # Restore original pubspec.yaml (publication-ready) | ||
| mv pubspec.yaml.backup pubspec.yaml | ||
| - name: Build Web example (validation) | ||
| run: | | ||
| cd parsec/example | ||
| flutter build web --release | ||
| - name: Upload test artifacts | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: web-test-artifacts-${{ matrix.flutter_version }} | ||
| path: | | ||
| parsec/coverage/ | ||
| parsec_web/lib/parsec-web/coverage/ | ||
| parsec/test-results.xml | ||
| retention-days: 3 | ||
| web_compatibility: | ||
| name: Web Compatibility Tests | ||
| runs-on: ubuntu-latest | ||
| needs: web_tests | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| - name: Setup Flutter | ||
| uses: subosito/flutter-action@v2 | ||
| with: | ||
| flutter-version: 3.24.0 | ||
| channel: stable | ||
| cache: true | ||
| - name: Download WASM artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: parsec-web-wasm | ||
| path: parsec_web/lib/parsec-web/wasm | ||
| - name: Test parsec-web npm package | ||
| run: | | ||
| cd parsec_web/lib/parsec-web | ||
| npm install | ||
| npm test | ||
| - name: Validate WebAssembly module | ||
| run: | | ||
| cd parsec_web/lib/parsec-web | ||
| if [ -f wasm/equations_parser.js ]; then | ||
| file wasm/equations_parser.js | ||
| ls -la wasm/ | ||
| else | ||
| echo "❌ WASM glue JS missing at wasm/equations_parser.js" && exit 1 | ||
| fi | ||
| - name: Test JavaScript imports | ||
| run: | | ||
| cd parsec_web/lib/parsec-web | ||
| node -e "const E = require('./index.cjs'); console.log('✅ CommonJS works')" | ||
| node --input-type=module -e "import('./index.mjs').then(()=>console.log('✅ ES6 works'))" | ||