first step on conversion of vb6runtime from Variant focused to locked… #83
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: Build Playground WASM | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| paths: | |
| - '.github/workflows/wasm.yml' | |
| - '.github/workflows/wasm-semantic.yml' | |
| - 'projects/vb6parse/**' | |
| - 'projects/vb6semantic/**' | |
| - 'projects/vb6interpret/**' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| detect: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| parse: ${{ steps.filter.outputs.parse }} | |
| semantic: ${{ steps.filter.outputs.semantic }} | |
| interpret: ${{ steps.filter.outputs.interpret }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Detect WASM targets | |
| id: filter | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| parse: | |
| - '.github/workflows/wasm.yml' | |
| - '.github/workflows/wasm-semantic.yml' | |
| - 'projects/vb6parse/**' | |
| - '!projects/vb6parse/tests/**' | |
| - '!projects/vb6parse/benches/**' | |
| - '!projects/vb6parse/examples/**' | |
| - '!projects/vb6parse/README.md' | |
| - '!projects/vb6parse/CHANGELOG.md' | |
| - '!projects/vb6parse/CONTRIBUTING.md' | |
| - '!projects/vb6parse/docs/**' | |
| semantic: | |
| - '.github/workflows/wasm.yml' | |
| - '.github/workflows/wasm-semantic.yml' | |
| - 'projects/vb6semantic/**' | |
| - '!projects/vb6semantic/README.md' | |
| - '!projects/vb6semantic/LICENSE' | |
| - '!projects/vb6semantic/docs/**' | |
| interpret: | |
| - '.github/workflows/wasm.yml' | |
| - '.github/workflows/wasm-semantic.yml' | |
| - 'projects/vb6interpret/**' | |
| - '!projects/vb6interpret/README.md' | |
| - '!projects/vb6interpret/docs/**' | |
| wasm: | |
| needs: detect | |
| if: needs.detect.outputs.parse == 'true' || needs.detect.outputs.semantic == 'true' || needs.detect.outputs.interpret == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: wasm32-unknown-unknown | |
| - name: Install wasm-pack | |
| run: cargo install wasm-pack | |
| - name: Install wasm-opt | |
| run: cargo install wasm-opt | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Show build tool versions | |
| run: | | |
| rustc --version | |
| cargo --version | |
| wasm-pack --version | |
| wasm-opt --version | |
| python3 --version | |
| - name: Build changed WASM modules | |
| env: | |
| BUILD_PARSE: ${{ needs.detect.outputs.parse }} | |
| BUILD_SEMANTIC: ${{ needs.detect.outputs.semantic }} | |
| BUILD_INTERPRET: ${{ needs.detect.outputs.interpret }} | |
| run: | | |
| set -euo pipefail | |
| if [[ "$BUILD_PARSE" == "true" ]]; then | |
| echo "Building vb6parse WASM" | |
| pushd projects/vb6parse > /dev/null | |
| python3 scripts/build-wasm.py --optimize --no-typescript | |
| popd > /dev/null | |
| fi | |
| if [[ "$BUILD_SEMANTIC" == "true" ]]; then | |
| echo "Building vb6semantic WASM" | |
| pushd projects/vb6semantic > /dev/null | |
| python3 scripts/build-wasm.py --optimize --no-typescript | |
| popd > /dev/null | |
| fi | |
| if [[ "$BUILD_INTERPRET" == "true" ]]; then | |
| echo "Building vb6interpret WASM" | |
| pushd projects/vb6interpret > /dev/null | |
| python3 scripts/build-wasm.py --optimize --no-typescript | |
| popd > /dev/null | |
| fi | |
| - name: Commit and push if changed | |
| env: | |
| BUILD_PARSE: ${{ needs.detect.outputs.parse }} | |
| BUILD_SEMANTIC: ${{ needs.detect.outputs.semantic }} | |
| BUILD_INTERPRET: ${{ needs.detect.outputs.interpret }} | |
| run: | | |
| set -euo pipefail | |
| git pull --rebase --autostash | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| if [[ "$BUILD_PARSE" == "true" ]]; then | |
| git add -f docs/vb6parse/assets/wasm/ | |
| fi | |
| if [[ "$BUILD_SEMANTIC" == "true" ]]; then | |
| git add -f docs/vb6semantic/assets/wasm/ | |
| fi | |
| if [[ "$BUILD_INTERPRET" == "true" ]]; then | |
| git add -f docs/vb6interpret/assets/wasm/ | |
| fi | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update playground WASM assets" | |
| git push | |
| fi |