9
9
workflow_dispatch :
10
10
branches :
11
11
- master
12
+ repository_dispatch : # listening to rv32emu-prebuilt events
13
+ types : [deploy_wasm]
12
14
13
15
jobs :
14
16
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'
16
20
runs-on : ubuntu-latest
17
21
steps :
18
22
- name : Check out the repo
@@ -22,12 +26,20 @@ jobs:
22
26
uses : tj-actions/changed-files@v45
23
27
with :
24
28
files : |
25
- assets/html/index.html
26
- assets/js/pre.js
29
+ assets/wasm/ html/index.html
30
+ assets/wasm/ js/pre.js
27
31
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
28
39
- name : install emcc
29
40
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' }}
31
43
run : |
32
44
git clone https://github.com/emscripten-core/emsdk.git
33
45
cd emsdk
@@ -38,29 +50,42 @@ jobs:
38
50
source ./emsdk_env.sh
39
51
echo "$PATH" >> $GITHUB_PATH
40
52
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
41
63
- name : build with emcc and move application files to /tmp
42
64
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' }}
44
67
run : |
45
- make CC=emcc ENABLE_GDBSTUB=0 ENABLE_SDL=1
68
+ make CC=emcc ENABLE_SDL=1
46
69
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
49
72
mv build/elf_list.js /tmp/rv32emu-demo
50
73
mv build/rv32emu.js /tmp/rv32emu-demo
51
74
mv build/rv32emu.wasm /tmp/rv32emu-demo
52
75
mv build/rv32emu.worker.js /tmp/rv32emu-demo
53
76
ls -al /tmp/rv32emu-demo
54
77
- name : Check out the rv32emu-demo repo
55
78
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' }}
57
81
uses : actions/checkout@v4
58
82
with :
59
83
persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
60
84
repository : sysprog21/rv32emu-demo
61
85
- name : Create local changes
62
86
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' }}
64
89
run : |
65
90
mv /tmp/rv32emu-demo/index.html .
66
91
mv /tmp/rv32emu-demo/coi-serviceworker.min.js .
@@ -70,15 +95,17 @@ jobs:
70
95
mv /tmp/rv32emu-demo/rv32emu.worker.js .
71
96
- name : Commit files
72
97
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' }}
74
100
run : |
75
101
git config --local user.email "github-actions[bot]@users.noreply.github.com"
76
102
git config --local user.name "github-actions[bot]"
77
103
git add --all
78
104
git commit -m "Add changes"
79
105
- name : Push changes
80
106
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' }}
82
109
uses : ad-m/github-push-action@master
83
110
with :
84
111
repository : sysprog21/rv32emu-demo
0 commit comments