Skip to content

Commit ce20acc

Browse files
authored
Merge pull request #489 from Interlisp/fgh_em-build-01
Add Emscripten build to buildRelease workflow
2 parents 586a320 + ce7dead commit ce20acc

File tree

4 files changed

+119
-15
lines changed

4 files changed

+119
-15
lines changed

.github/workflows/buildRelease.yml

Lines changed: 89 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
echo "linux=true" >> $GITHUB_OUTPUT;
108108
echo "macos=true" >> $GITHUB_OUTPUT;
109109
echo "windows=true" >> $GITHUB_OUTPUT;
110-
110+
111111
112112
######################################################################################
113113

@@ -123,7 +123,7 @@ jobs:
123123
steps:
124124
# Checkout the actions for this repo owner
125125
- name: Checkout Actions
126-
uses: actions/checkout@v3
126+
uses: actions/checkout@v4
127127
with:
128128
repository: ${{ github.repository_owner }}/.github
129129
path: ./Actions_${{ github.sha }}
@@ -157,15 +157,15 @@ jobs:
157157
steps:
158158
# Checkout the actions for this repo owner
159159
- name: Checkout Actions
160-
uses: actions/checkout@v3
160+
uses: actions/checkout@v4
161161
with:
162162
repository: ${{ github.repository_owner }}/.github
163163
path: ./Actions_${{ github.sha }}
164164
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
165165

166166
# Checkout the branch
167167
- name: Checkout
168-
uses: actions/checkout@v3
168+
uses: actions/checkout@v4
169169

170170
# Setup release tag
171171
- name: Setup Release Tag
@@ -272,11 +272,11 @@ jobs:
272272

273273
# Checkout the branch
274274
- name: Checkout
275-
uses: actions/checkout@v3
275+
uses: actions/checkout@v4
276276

277277
# Checkout the actions for this repo owner
278278
- name: Checkout Actions
279-
uses: actions/checkout@v3
279+
uses: actions/checkout@v4
280280
with:
281281
repository: ${{ github.repository_owner }}/.github
282282
path: ./Actions_${{ github.sha }}
@@ -324,7 +324,7 @@ jobs:
324324
export LDEARCH=aarch64-apple-darwin
325325
./makeright init
326326
mkdir -p ../darwin.universal
327-
exe=ldeinit
327+
exe=ldeinit
328328
lipo -create \
329329
-arch arm64 ../darwin.aarch64/${exe} \
330330
-arch x86_64 ../darwin.x86_64/${exe} \
@@ -346,7 +346,7 @@ jobs:
346346
lipo ${exe} -output ../darwin.x86_64/${exe} -extract x86_64
347347
lipo ${exe} -output ../darwin.aarch64/${exe} -extract arm64
348348
cp -p ${exe} ../darwin.universal/${exe}
349-
done
349+
done
350350
351351
# Create release tar for github.
352352
- name: Make release tar(s)
@@ -369,7 +369,7 @@ jobs:
369369
# Push Release
370370
- name: Push the release
371371
uses: ncipollo/release-action@v1
372-
with:
372+
with:
373373
allowUpdates: true
374374
artifacts:
375375
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz,
@@ -383,7 +383,7 @@ jobs:
383383

384384
# Windows: build for Windows-Cygwin via Docker build and use results to
385385
# create and push release assets to github
386-
386+
387387
windows:
388388

389389
needs: [inputs, sentry]
@@ -418,21 +418,21 @@ jobs:
418418
# Retrieve SDL2 and install in cygwin
419419
- name: Install SDL2
420420
id: sdl2
421-
env:
421+
env:
422422
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
423423
run: |
424424
gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz
425425
cygwin\bin\bash -login -c 'cd /; tar xzf sdl2.tar.gz'
426426
427427
# Checkout the branch
428428
- name: Checkout
429-
uses: actions/checkout@v3
429+
uses: actions/checkout@v4
430430
with:
431431
path: cygwin\maiko
432432

433433
# Checkout the actions for this repo owner
434434
- name: Checkout Actions
435-
uses: actions/checkout@v3
435+
uses: actions/checkout@v4
436436
with:
437437
repository: ${{ github.repository_owner }}/.github
438438
path: ./Actions_${{ github.sha }}
@@ -473,6 +473,80 @@ jobs:
473473

474474

475475

476+
######################################################################################
477+
478+
# Emscripten: build and push Maiko compiled for Emscripten (to run Maiko in browser)
479+
480+
emscripten:
481+
482+
needs: [inputs, sentry]
483+
if: |
484+
needs.inputs.outputs.linux == 'true'
485+
&& (
486+
needs.sentry.outputs.release_not_built == 'true'
487+
|| needs.inputs.outputs.force == 'true'
488+
)
489+
490+
runs-on: ubuntu-latest
491+
492+
steps:
493+
494+
# Checkout the actions for this repo owner
495+
- name: Checkout Actions
496+
uses: actions/checkout@v4
497+
with:
498+
repository: ${{ github.repository_owner }}/.github
499+
path: ./Actions_${{ github.sha }}
500+
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
501+
502+
# Install SDL2
503+
- name: Install SDL2
504+
run: |
505+
export DEBIAN_FRONTEND=noninteractive
506+
sudo -E apt-get install -y libsdl2-dev libsdl2-2.0-0
507+
508+
# Install Emscripten SDK
509+
- name: Install Empscripten
510+
working-directory: ../
511+
run: |
512+
git clone https://github.com/emscripten-core/emsdk.git
513+
cd emsdk
514+
./emsdk install latest
515+
./emsdk activate latest
516+
CWD="$(pwd)"
517+
echo "${CWD}" >> ${GITHUB_PATH}
518+
echo "${CWD}/upstream/emscripten" >> ${GITHUB_PATH}
519+
echo "${CWD}/upstream/emscripten/tools" >> ${GITHUB_PATH}
520+
echo "${CWD}/node/$(ls -d node/*64bit | tail -1)/bin" >> ${GITHUB_PATH}
521+
522+
# Checkout the maiko branch
523+
- name: Checkout
524+
uses: actions/checkout@v4
525+
526+
# Setup release tag
527+
- name: Setup Release Tag
528+
id: tag
529+
uses: ./../actions/release-tag-action
530+
531+
# Compile maiko using Emscripten (no load build)
532+
- name: Compile Maiko using Emscripten
533+
working-directory: ./bin
534+
run: |
535+
./makeright wasm_nl
536+
cd ../emscripten.wasm_nl
537+
tar -c -z -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz *
538+
539+
# Push Release to github
540+
- name: Push the release
541+
uses: ncipollo/release-action@v1
542+
with:
543+
allowUpdates: true
544+
artifacts: ${{ steps.tag.outputs.release_tag }}-emscripten.tgz
545+
tag: ${{ steps.tag.outputs.release_tag }}
546+
draft: ${{ needs.inputs.outputs.draft }}
547+
token: ${{ secrets.GITHUB_TOKEN }}
548+
549+
476550
######################################################################################
477551

478552
# Use set-sentry-action to determine set the sentry that says this release has
@@ -485,12 +559,12 @@ jobs:
485559
outputs:
486560
build_successful: ${{ steps.output.outputs.build_successful }}
487561

488-
needs: [inputs, sentry, linux, macos, windows]
562+
needs: [inputs, sentry, linux, macos, windows, emscripten]
489563

490564
steps:
491565
# Checkout the actions for this repo owner
492566
- name: Checkout Actions
493-
uses: actions/checkout@v3
567+
uses: actions/checkout@v4
494568
with:
495569
repository: ${{ github.repository_owner }}/.github
496570
path: ./Actions_${{ github.sha }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ cmake-build-*/**
2121
*.x86_64/**
2222
*.wasm/**
2323
*.wasm-wasm/**
24+
*.wasm_nl/**
25+
*.wasm_nl-wasm_nl/**
2426
*.armv7l-x/**
2527
*.armv7l/**
2628
*.aarch64-x/**
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Options for Emscripten, WASM and SDL
2+
3+
CC = emcc $(CLANG_CFLAGS)
4+
5+
XFILES = $(OBJECTDIR)sdl.o
6+
7+
XFLAGS = -DSDL -sUSE_SDL=2
8+
9+
# OPTFLAGS is normally -O2.
10+
OPTFLAGS = -O2
11+
DFLAGS = $(XFLAGS) -DRELEASE=351 -DMAIKO_ENABLE_NETHUB
12+
13+
MEDLEY?=../../medley
14+
SYSOUT?=$(MEDLEY)/loadups/full.sysout
15+
16+
LD = emcc
17+
LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sFORCE_FILESYSTEM -sLZ4
18+
19+
LDELDFLAGS =
20+
21+
OBJECTDIR = ../$(RELEASENAME)/
22+
23+
default : ../$(OSARCHNAME)/ldesdl.js

bin/makeright

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ case "$display" in
7979
releasename=${osversion}.${architecture}-${display}
8080
ldename=ldesdl.js
8181
;;
82+
wasm_nl) osversion=emscripten
83+
architecture=wasm_nl
84+
releasename=${osversion}.${architecture}-${display}
85+
ldename=ldesdl.js
86+
;;
8287
*) echo "display-option: $display is not supported."
8388
exit
8489
;;

0 commit comments

Comments
 (0)