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,19 @@ 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
+ # Files below may have a potential performance impact (reference from benchmark.yml)
33
+ src/riscv.c
34
+ src/decode.c
35
+ src/emulate.c
36
+ src/rv32_template.c
37
+ src/rv32_constopt.c
28
38
- name : install emcc
29
39
if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
30
- github.event_name == 'workflow_dispatch'}}
40
+ github.event_name == 'workflow_dispatch' ||
41
+ github.event_name == 'repository_dispatch' }}
31
42
run : |
32
43
git clone https://github.com/emscripten-core/emsdk.git
33
44
cd emsdk
@@ -38,29 +49,42 @@ jobs:
38
49
source ./emsdk_env.sh
39
50
echo "$PATH" >> $GITHUB_PATH
40
51
shell : bash
52
+ - name : fetch artifact
53
+ run : |
54
+ make artifact
55
+ # Hack Cloudflare 403 Forbidden on GitHub Runner for Doom artifact download
56
+ wget --header="User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" \
57
+ --header="Referer: https://www.doomworld.com/" \
58
+ --header="Accept-Language: en-US,en;q=0.9" \
59
+ -O build/shareware_doom_iwad.zip \
60
+ "https://www.doomworld.com/3ddownloads/ports/shareware_doom_iwad.zip"
61
+ unzip -d build/ build/shareware_doom_iwad.zip
41
62
- name : build with emcc and move application files to /tmp
42
63
if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
43
- github.event_name == 'workflow_dispatch'}}
64
+ github.event_name == 'workflow_dispatch' ||
65
+ github.event_name == 'repository_dispatch' }}
44
66
run : |
45
- make CC=emcc ENABLE_GDBSTUB=0 ENABLE_SDL=1
67
+ make CC=emcc ENABLE_SDL=1
46
68
mkdir /tmp/rv32emu-demo
47
- mv assets/html/index.html /tmp/rv32emu-demo
48
- mv assets/js/coi-serviceworker.min.js /tmp/rv32emu-demo
69
+ mv assets/wasm/ html/index.html /tmp/rv32emu-demo
70
+ mv assets/wasm/ js/coi-serviceworker.min.js /tmp/rv32emu-demo
49
71
mv build/elf_list.js /tmp/rv32emu-demo
50
72
mv build/rv32emu.js /tmp/rv32emu-demo
51
73
mv build/rv32emu.wasm /tmp/rv32emu-demo
52
74
mv build/rv32emu.worker.js /tmp/rv32emu-demo
53
75
ls -al /tmp/rv32emu-demo
54
76
- name : Check out the rv32emu-demo repo
55
77
if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
56
- github.event_name == 'workflow_dispatch'}}
78
+ github.event_name == 'workflow_dispatch' ||
79
+ github.event_name == 'repository_dispatch' }}
57
80
uses : actions/checkout@v4
58
81
with :
59
82
persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
60
83
repository : sysprog21/rv32emu-demo
61
84
- name : Create local changes
62
85
if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
63
- github.event_name == 'workflow_dispatch'}}
86
+ github.event_name == 'workflow_dispatch' ||
87
+ github.event_name == 'repository_dispatch' }}
64
88
run : |
65
89
mv /tmp/rv32emu-demo/index.html .
66
90
mv /tmp/rv32emu-demo/coi-serviceworker.min.js .
@@ -70,15 +94,17 @@ jobs:
70
94
mv /tmp/rv32emu-demo/rv32emu.worker.js .
71
95
- name : Commit files
72
96
if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
73
- github.event_name == 'workflow_dispatch'}}
97
+ github.event_name == 'workflow_dispatch' ||
98
+ github.event_name == 'repository_dispatch' }}
74
99
run : |
75
100
git config --local user.email "github-actions[bot]@users.noreply.github.com"
76
101
git config --local user.name "github-actions[bot]"
77
102
git add --all
78
103
git commit -m "Add changes"
79
104
- name : Push changes
80
105
if : ${{ steps.changed-files.outputs.any_modified == 'true' ||
81
- github.event_name == 'workflow_dispatch'}}
106
+ github.event_name == 'workflow_dispatch' ||
107
+ github.event_name == 'repository_dispatch' }}
82
108
uses : ad-m/github-push-action@master
83
109
with :
84
110
repository : sysprog21/rv32emu-demo
0 commit comments