1010 branches :
1111 - master
1212 repository_dispatch : # listening to rv32emu-prebuilt events
13- types : [deploy_wasm ]
13+ types : [deploy_user_wasm, deploy_system_wasm ]
1414
1515jobs :
16- wasm-deploy :
16+ wasm-system- deploy :
1717 if : github.event.pull_request.merged == true ||
1818 github.event_name == 'workflow_dispatch' ||
19- github.event_name == 'repository_dispatch'
19+ github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm'
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 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' && github.event.action == 'deploy_system_wasm') }}
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+ # get from rv32emu-prebuilt
61+ wget -O build/shareware_doom_iwad.zip "https://raw.githubusercontent.com/sysprog21/rv32emu-prebuilt/doom-artifact/shareware_doom_iwad.zip"
62+ unzip -d build/ build/shareware_doom_iwad.zip
63+ - name : build with emcc and move application files to /tmp
64+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
65+ github.event_name == 'workflow_dispatch' ||
66+ (github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
67+ run : |
68+ make CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j
69+ mkdir /tmp/rv32emu-system-demo
70+ mv assets/wasm/html/system.html /tmp/rv32emu-system-demo/index.html
71+ mv assets/wasm/js/coi-serviceworker.min.js /tmp/rv32emu-system-demo
72+ mv build/rv32emu.js /tmp/rv32emu-system-demo
73+ mv build/rv32emu.wasm /tmp/rv32emu-system-demo
74+ mv build/rv32emu.worker.js /tmp/rv32emu-system-demo
75+ ls -al /tmp/rv32emu-system-demo
76+ - name : Check out the rv32emu-system-demo repo
77+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
78+ github.event_name == 'workflow_dispatch' ||
79+ (github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
80+ uses : actions/checkout@v4
81+ with :
82+ persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
83+ repository : sysprog21/rv32emu-demo
84+ - name : Create local changes
85+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
86+ github.event_name == 'workflow_dispatch' ||
87+ (github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
88+ run : |
89+ mkdir -p system
90+ mv /tmp/rv32emu-system-demo/index.html ./system
91+ mv /tmp/rv32emu-system-demo/coi-serviceworker.min.js ./system
92+ mv /tmp/rv32emu-system-demo/rv32emu.js ./system
93+ mv /tmp/rv32emu-system-demo/rv32emu.wasm ./system
94+ mv /tmp/rv32emu-system-demo/rv32emu.worker.js ./system
95+ - name : Commit files
96+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
97+ github.event_name == 'workflow_dispatch' ||
98+ (github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
99+ run : |
100+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
101+ git config --local user.name "github-actions[bot]"
102+ git add system/
103+ git commit -m "Add changes to system emulation"
104+ - name : Push changes
105+ if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
106+ github.event_name == 'workflow_dispatch' ||
107+ (github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
108+ uses : ad-m/github-push-action@master
109+ with :
110+ repository : sysprog21/rv32emu-demo
111+ github_token : ${{ secrets.RV32EMU_DEMO_TOKEN }}
112+ branch : main
113+ wasm-user-deploy :
114+ needs : wasm-system-deploy # run jobs sequentially since two jobs operate on same reposity: rv32emu-demo
115+ if : always() # ensures wasm-user-deploy runs regardless of the outcome or condition of wasm-system-deploy
20116 runs-on : ubuntu-latest
21117 steps :
22118 - name : Check out the repo
26122 uses : tj-actions/changed-files@v46
27123 with :
28124 files : |
29- assets/wasm/html/index .html
30- assets/wasm/js/pre.js
125+ assets/wasm/html/user .html
126+ assets/wasm/js/user- pre.js
31127 build/*.elf
32128 tools/gen-elf-list-js.py
33129 # Files below may have a potential performance impact (reference from benchmark.yml)
39135 - name : install emcc
40136 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
41137 github.event_name == 'workflow_dispatch' ||
42- github.event_name == 'repository_dispatch' }}
138+ ( github.event_name == 'repository_dispatch' && github.event.action == 'deploy_user_wasm') }}
43139 run : |
44140 git clone https://github.com/emscripten-core/emsdk.git
45141 cd emsdk
@@ -53,21 +149,17 @@ jobs:
53149 - name : fetch artifact
54150 run : |
55151 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"
152+ # get from rv32emu-prebuilt
153+ wget -O build/shareware_doom_iwad.zip "https://raw.githubusercontent.com/sysprog21/rv32emu-prebuilt/doom-artifact/shareware_doom_iwad.zip"
62154 unzip -d build/ build/shareware_doom_iwad.zip
63155 - name : build with emcc and move application files to /tmp
64156 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
65157 github.event_name == 'workflow_dispatch' ||
66- github.event_name == 'repository_dispatch' }}
158+ ( github.event_name == 'repository_dispatch' && github.event.action == 'deploy_user_wasm') }}
67159 run : |
68160 make CC=emcc ENABLE_SDL=1
69161 mkdir /tmp/rv32emu-demo
70- mv assets/wasm/html/index .html /tmp/rv32emu-demo
162+ mv assets/wasm/html/user .html /tmp/rv32emu-demo/index.html
71163 mv assets/wasm/js/coi-serviceworker.min.js /tmp/rv32emu-demo
72164 mv build/elf_list.js /tmp/rv32emu-demo
73165 mv build/rv32emu.js /tmp/rv32emu-demo
@@ -77,15 +169,15 @@ jobs:
77169 - name : Check out the rv32emu-demo repo
78170 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
79171 github.event_name == 'workflow_dispatch' ||
80- github.event_name == 'repository_dispatch' }}
172+ ( github.event_name == 'repository_dispatch' && github.event.action == 'deploy_user_wasm') }}
81173 uses : actions/checkout@v4
82174 with :
83175 persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
84176 repository : sysprog21/rv32emu-demo
85177 - name : Create local changes
86178 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
87179 github.event_name == 'workflow_dispatch' ||
88- github.event_name == 'repository_dispatch' }}
180+ ( github.event_name == 'repository_dispatch' && github.event.action == 'deploy_user_wasm') }}
89181 run : |
90182 mv /tmp/rv32emu-demo/index.html .
91183 mv /tmp/rv32emu-demo/coi-serviceworker.min.js .
@@ -96,16 +188,16 @@ jobs:
96188 - name : Commit files
97189 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
98190 github.event_name == 'workflow_dispatch' ||
99- github.event_name == 'repository_dispatch' }}
191+ ( github.event_name == 'repository_dispatch' && github.event.action == 'deploy_user_wasm') }}
100192 run : |
101193 git config --local user.email "github-actions[bot]@users.noreply.github.com"
102194 git config --local user.name "github-actions[bot]"
103195 git add --all
104- git commit -m "Add changes"
196+ git commit -m "Add changes to user emulation "
105197 - name : Push changes
106198 if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
107199 github.event_name == 'workflow_dispatch' ||
108- github.event_name == 'repository_dispatch' }}
200+ ( github.event_name == 'repository_dispatch' && github.event.action == 'deploy_user_wasm') }}
109201 uses : ad-m/github-push-action@master
110202 with :
111203 repository : sysprog21/rv32emu-demo
0 commit comments