diff --git a/.github/workflows/wasm-build.yaml b/.github/workflows/wasm-build.yaml new file mode 100644 index 0000000..b6e4080 --- /dev/null +++ b/.github/workflows/wasm-build.yaml @@ -0,0 +1,58 @@ +name: WASM Build + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + wasm-build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.ref }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-${{ github.ref }}- + + - name: Build Docker image for WASM + uses: docker/build-push-action@v4 + with: + context: . + file: wasm/Dockerfile + tags: vibra-wasm:latest + push: false + load: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + - name: Run Docker container for WASM build + run: | + docker run --rm -v $(pwd)/wasm/build:/app/wasm/build vibra-wasm:latest + + - name: Upload WASM artifacts + uses: actions/upload-artifact@v3 + with: + name: wasm-build + path: | + wasm/build/vibra.wasm + wasm/build/vibra.js