99 workflow_dispatch :
1010 branches :
1111 - master
12+ repository_dispatch : # listening to rv32emu-prebuilt events
13+ types : [deploy_wasm]
1214
1315jobs :
1416 wasm-deploy :
15- if : github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
17+ if : github.event.pull_request.merged == true ||
18+ github.event_name == 'workflow_dispatch' ||
19+ github.event_name == 'repository_dispatch'
1620 runs-on : ubuntu-latest
1721 steps :
1822 - name : Check out the repo
@@ -22,12 +26,20 @@ jobs:
2226 uses : tj-actions/changed-files@v45
2327 with :
2428 files : |
25- assets/html/index.html
26- assets/js/pre.js
29+ assets/wasm/ html/index.html
30+ assets/wasm/ js/pre.js
2731 build/*.elf
32+ tools/gen-elf-list-js.py
33+ # Files below may have a potential performance impact (reference from benchmark.yml)
34+ src/riscv.c
35+ src/decode.c
36+ src/emulate.c
37+ src/rv32_template.c
38+ src/rv32_constopt.c
2839 - name : install emcc
2940 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
30- github.event_name == 'workflow_dispatch'}}
41+ github.event_name == 'workflow_dispatch' ||
42+ github.event_name == 'repository_dispatch' }}
3143 run : |
3244 git clone https://github.com/emscripten-core/emsdk.git
3345 cd emsdk
@@ -38,29 +50,42 @@ jobs:
3850 source ./emsdk_env.sh
3951 echo "$PATH" >> $GITHUB_PATH
4052 shell : bash
53+ - name : fetch artifact
54+ run : |
55+ make artifact
56+ # Hack Cloudflare 403 Forbidden on GitHub Runner for Doom artifact download
57+ wget --header="User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" \
58+ --header="Referer: https://www.doomworld.com/" \
59+ --header="Accept-Language: en-US,en;q=0.9" \
60+ -O build/shareware_doom_iwad.zip \
61+ "https://www.doomworld.com/3ddownloads/ports/shareware_doom_iwad.zip"
62+ unzip -d build/ build/shareware_doom_iwad.zip
4163 - name : build with emcc and move application files to /tmp
4264 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
43- github.event_name == 'workflow_dispatch'}}
65+ github.event_name == 'workflow_dispatch' ||
66+ github.event_name == 'repository_dispatch' }}
4467 run : |
45- make CC=emcc ENABLE_GDBSTUB=0 ENABLE_SDL=1
68+ make CC=emcc ENABLE_SDL=1
4669 mkdir /tmp/rv32emu-demo
47- mv assets/html/index.html /tmp/rv32emu-demo
48- mv assets/js/coi-serviceworker.min.js /tmp/rv32emu-demo
70+ mv assets/wasm/ html/index.html /tmp/rv32emu-demo
71+ mv assets/wasm/ js/coi-serviceworker.min.js /tmp/rv32emu-demo
4972 mv build/elf_list.js /tmp/rv32emu-demo
5073 mv build/rv32emu.js /tmp/rv32emu-demo
5174 mv build/rv32emu.wasm /tmp/rv32emu-demo
5275 mv build/rv32emu.worker.js /tmp/rv32emu-demo
5376 ls -al /tmp/rv32emu-demo
5477 - name : Check out the rv32emu-demo repo
5578 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
56- github.event_name == 'workflow_dispatch'}}
79+ github.event_name == 'workflow_dispatch' ||
80+ github.event_name == 'repository_dispatch' }}
5781 uses : actions/checkout@v4
5882 with :
5983 persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
6084 repository : sysprog21/rv32emu-demo
6185 - name : Create local changes
6286 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
63- github.event_name == 'workflow_dispatch'}}
87+ github.event_name == 'workflow_dispatch' ||
88+ github.event_name == 'repository_dispatch' }}
6489 run : |
6590 mv /tmp/rv32emu-demo/index.html .
6691 mv /tmp/rv32emu-demo/coi-serviceworker.min.js .
@@ -70,15 +95,17 @@ jobs:
7095 mv /tmp/rv32emu-demo/rv32emu.worker.js .
7196 - name : Commit files
7297 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
73- github.event_name == 'workflow_dispatch'}}
98+ github.event_name == 'workflow_dispatch' ||
99+ github.event_name == 'repository_dispatch' }}
74100 run : |
75101 git config --local user.email "github-actions[bot]@users.noreply.github.com"
76102 git config --local user.name "github-actions[bot]"
77103 git add --all
78104 git commit -m "Add changes"
79105 - name : Push changes
80106 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
81- github.event_name == 'workflow_dispatch'}}
107+ github.event_name == 'workflow_dispatch' ||
108+ github.event_name == 'repository_dispatch' }}
82109 uses : ad-m/github-push-action@master
83110 with :
84111 repository : sysprog21/rv32emu-demo
0 commit comments