mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
e5f361500e
Unfortunately a composite action cannot have a `post:` step like JavaScript actions are allowed to have, so we need to explicitly call the post/save actions ourselves from the workflow file when we want to save Toolchain/QEMU/ccache caches. Co-Authored-By: Timothy Flynn <trflynn89@pm.me>
112 lines
3.8 KiB
YAML
112 lines
3.8 KiB
YAML
name: Build Wasm Modules
|
|
on: [ push, pull_request ]
|
|
|
|
env:
|
|
SERENITY_SOURCE_DIR: ${{ github.workspace }}
|
|
SERENITY_CCACHE_DIR: ${{ github.workspace }}/.ccache
|
|
|
|
concurrency: wasm
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-22.04
|
|
if: github.repository == 'SerenityOS/serenity'
|
|
strategy:
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout SerenityOS/serenity
|
|
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 \
|
|
-DBUILD_LAGOM=OFF \
|
|
-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 \
|
|
-DBUILD_LAGOM=ON \
|
|
-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: ${{ matrix.arch }}
|
|
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.0
|
|
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
|