1313 types : [deploy_wasm]
1414
1515jobs :
16- wasm-deploy :
16+ wasm-system-deploy :
17+ if : github.event.pull_request.merged == true ||
18+ github.event_name == 'workflow_dispatch' ||
19+ github.event_name == 'repository_dispatch'
20+ runs-on : ubuntu-latest
21+ steps :
22+ - name : Check out the repo
23+ uses : actions/checkout@v4
24+ - name : install-dependencies
25+ run : |
26+ sudo apt-get update -q=2
27+ sudo apt-get install -q=2 libsdl2-dev libsdl2-mixer-dev device-tree-compiler
28+ - name : Verify if the JS or HTML files has been modified
29+ id : changed-files
30+ uses : tj-actions/changed-files@v46
31+ with :
32+ files : |
33+ assets/wasm/html/system.html
34+ assets/wasm/js/system-pre.js
35+ # Files below may have a potential performance impact (reference from benchmark.yml)
36+ src/devices/*.c
37+ src/system.c
38+ src/riscv.c
39+ src/decode.c
40+ src/emulate.c
41+ src/rv32_template.c
42+ src/rv32_constopt.c
43+ - name : install emcc
44+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
45+ github.event_name == 'workflow_dispatch' ||
46+ github.event_name == 'repository_dispatch' }}
47+ run : |
48+ git clone https://github.com/emscripten-core/emsdk.git
49+ cd emsdk
50+ git pull
51+ git checkout 3.1.51
52+ ./emsdk install latest
53+ ./emsdk activate latest
54+ source ./emsdk_env.sh
55+ echo "$PATH" >> $GITHUB_PATH
56+ shell : bash
57+ - name : fetch artifact
58+ run : |
59+ make artifact
60+ # Hack Cloudflare 403 Forbidden on GitHub Runner for Doom artifact download
61+ #wget --header="User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" \
62+ # --header="Referer: https://www.doomworld.com/" \
63+ # --header="Accept-Language: en-US,en;q=0.9" \
64+ # -O build/shareware_doom_iwad.zip \
65+ # "https://www.doomworld.com/3ddownloads/ports/shareware_doom_iwad.zip"
66+ unzip -d build/ build/shareware_doom_iwad.zip
67+ - name : build with emcc and move application files to /tmp
68+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
69+ github.event_name == 'workflow_dispatch' ||
70+ github.event_name == 'repository_dispatch' }}
71+ run : |
72+ make CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j
73+ mkdir /tmp/rv32emu-system-demo
74+ mv assets/wasm/html/system.html /tmp/rv32emu-system-demo/index.html
75+ mv assets/wasm/js/coi-serviceworker.min.js /tmp/rv32emu-system-demo
76+ mv build/rv32emu.js /tmp/rv32emu-system-demo
77+ mv build/rv32emu.wasm /tmp/rv32emu-system-demo
78+ mv build/rv32emu.worker.js /tmp/rv32emu-system-demo
79+ ls -al /tmp/rv32emu-system-demo
80+ - name : Check out the rv32emu-system-demo repo
81+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
82+ github.event_name == 'workflow_dispatch' ||
83+ github.event_name == 'repository_dispatch' }}
84+ uses : actions/checkout@v4
85+ with :
86+ persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
87+ repository : sysprog21/rv32emu-demo
88+ - name : Create local changes
89+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
90+ github.event_name == 'workflow_dispatch' ||
91+ github.event_name == 'repository_dispatch' }}
92+ run : |
93+ mkdir -p system
94+ mv /tmp/rv32emu-system-demo/index.html ./system
95+ mv /tmp/rv32emu-system-demo/coi-serviceworker.min.js ./system
96+ mv /tmp/rv32emu-system-demo/rv32emu.js ./system
97+ mv /tmp/rv32emu-system-demo/rv32emu.wasm ./system
98+ mv /tmp/rv32emu-system-demo/rv32emu.worker.js ./system
99+ - name : Commit files
100+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
101+ github.event_name == 'workflow_dispatch' ||
102+ github.event_name == 'repository_dispatch' }}
103+ run : |
104+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
105+ git config --local user.name "github-actions[bot]"
106+ git add system/
107+ git commit -m "Add changes to system emulation"
108+ - name : Push changes
109+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
110+ github.event_name == 'workflow_dispatch' ||
111+ github.event_name == 'repository_dispatch' }}
112+ uses : ad-m/github-push-action@master
113+ with :
114+ repository : sysprog21/rv32emu-demo
115+ github_token : ${{ secrets.RV32EMU_DEMO_TOKEN }}
116+ branch : main
117+ wasm-user-deploy :
118+ needs : wasm-system-deploy # to run jobs sequentially
17119 if : github.event.pull_request.merged == true ||
18120 github.event_name == 'workflow_dispatch' ||
19121 github.event_name == 'repository_dispatch'
26128 uses : tj-actions/changed-files@v46
27129 with :
28130 files : |
29- assets/wasm/html/index .html
30- assets/wasm/js/pre.js
131+ assets/wasm/html/user .html
132+ assets/wasm/js/user- pre.js
31133 build/*.elf
32134 tools/gen-elf-list-js.py
33135 # Files below may have a potential performance impact (reference from benchmark.yml)
@@ -54,11 +156,11 @@ jobs:
54156 run : |
55157 make artifact
56158 # 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"
159+ # wget --header="User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" \
160+ # --header="Referer: https://www.doomworld.com/" \
161+ # --header="Accept-Language: en-US,en;q=0.9" \
162+ # -O build/shareware_doom_iwad.zip \
163+ # "https://www.doomworld.com/3ddownloads/ports/shareware_doom_iwad.zip"
62164 unzip -d build/ build/shareware_doom_iwad.zip
63165 - name : build with emcc and move application files to /tmp
64166 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
67169 run : |
68170 make CC=emcc ENABLE_SDL=1
69171 mkdir /tmp/rv32emu-demo
70- mv assets/wasm/html/index .html /tmp/rv32emu-demo
172+ mv assets/wasm/html/user .html /tmp/rv32emu-demo/index.html
71173 mv assets/wasm/js/coi-serviceworker.min.js /tmp/rv32emu-demo
72174 mv build/elf_list.js /tmp/rv32emu-demo
73175 mv build/rv32emu.js /tmp/rv32emu-demo
@@ -101,7 +203,7 @@ jobs:
101203 git config --local user.email "github-actions[bot]@users.noreply.github.com"
102204 git config --local user.name "github-actions[bot]"
103205 git add --all
104- git commit -m "Add changes"
206+ git commit -m "Add changes to user emulation "
105207 - name : Push changes
106208 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
107209 github.event_name == 'workflow_dispatch' ||
0 commit comments