name: Build Wasm Modules on: [ push, pull_request ] env: LADYBIRD_SOURCE_DIR: ${{ github.workspace }} SERENITY_CCACHE_DIR: ${{ github.workspace }}/.ccache concurrency: wasm jobs: build: runs-on: ubuntu-22.04 if: false strategy: fail-fast: false steps: - name: Checkout LadybirdBrowser/ladybird uses: actions/checkout@v4 - name: Checkout SerenityOS/libjs-data libjs-wasm uses: actions/checkout@v4 with: repository: SerenityOS/libjs-data path: libjs-data ref: libjs-wasm - name: "Set up environment" uses: ./.github/actions/setup with: os: 'Linux' arch: 'Lagom' - name: "Install emscripten" uses: mymindstorm/setup-emsdk@v14 with: version: 3.1.25 - name: Restore Caches uses: ./.github/actions/cache-restore id: 'cache-restore' with: os: 'Linux' arch: 'Lagom' cache_key_extra: 'WASM' serenity_ccache_path: ${{ env.SERENITY_CCACHE_DIR }} download_cache_path: ${{ github.workspace }}/Build/caches - name: "Build host lagom tools" run: | cmake -GNinja \ -B ${{ github.workspace }}/Build/lagom-tools \ -S ${{ github.workspace }}/Meta/Lagom \ -DLAGOM_TOOLS_ONLY=ON -DSERENITY_CACHE_DIR=${{ github.workspace }}/Build/caches \ -DCMAKE_C_COMPILER=gcc-13 \ -DCMAKE_CXX_COMPILER=g++-13 \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/Build/lagom-tools \ -Dpackage=LagomTools ninja -C ${{ github.workspace }}/Build/lagom-tools install env: CCACHE_DIR: ${{ env.SERENITY_CCACHE_DIR }} - name: "Create wasm build environment" run: | emcmake cmake -GNinja \ -B ${{ github.workspace }}/Build/wasm \ -S ${{ github.workspace }}/Meta/Lagom \ -DLagomTools_DIR=${{ github.workspace }}/Build/lagom-tools/share/LagomTools \ -DSERENITY_CACHE_DIR=${{ github.workspace }}/Build/caches \ -DBUILD_SHARED_LIBS=OFF env: CCACHE_DIR: ${{ env.SERENITY_CCACHE_DIR }} - name: "Build libjs.{js,wasm}" run: | ninja -C ${{ github.workspace }}/Build/wasm libjs.js env: CCACHE_DIR: ${{ env.SERENITY_CCACHE_DIR }} - name: Save Caches uses: ./.github/actions/cache-save with: arch: 'Lagom' serenity_ccache_path: ${{ env.SERENITY_CCACHE_DIR }} serenity_ccache_primary_key: ${{ steps.cache-restore.outputs.serenity_ccache_primary_key }} - name: "Prepare files" run: | cp ${{ github.workspace }}/Build/wasm/bin/libjs.js ${{ github.workspace }}/libjs-data/libjs.js cp ${{ github.workspace }}/Build/wasm/bin/libjs.wasm ${{ github.workspace }}/libjs-data/libjs.wasm echo 'Module.SERENITYOS_COMMIT = "${{ github.sha }}";' >> ${{ github.workspace }}/libjs-data/libjs.js tar --exclude='.[^/]*' -czvf libjs-wasm.tar.gz -C ${{ github.workspace }}/libjs-data . - name: Deploy to GitHub uses: JamesIves/github-pages-deploy-action@v4.6.1 if: github.ref == 'refs/heads/master' with: git-config-name: BuggieBot git-config-email: buggiebot@serenityos.org branch: libjs-wasm repository-name: SerenityOS/libjs-data token: ${{ secrets.BUGGIEBOT_TOKEN }} folder: ${{ github.workspace }}/libjs-data - name: Upload artifact package if: github.ref == 'refs/heads/master' uses: actions/upload-artifact@v4 with: name: serenity-js-wasm path: libjs-wasm.tar.gz retention-days: 7