8000 CI: deploy wasm by ChinYikMing · Pull Request #389 · sysprog21/rv32emu · GitHub
[go: up one dir, main page]

Skip to content

Conversation

ChinYikMing
Copy link
Collaborator
@ChinYikMing ChinYikMing commented Mar 27, 2024

Since wasm is deployed on Github Pages, thus it is reasonable to use CI to deploy automatically.

The CI supports two events: merged pull request and workflow_dispatch. The former only run after merging and latter is used to deploy by maintainer manually. It also verifies whether any associated files have changed. If so, carry out the CI; if not, stop.

Related: #75

Since wasm is deployed on Github Pages, thus it is reasonable to use CI
to deploy automatically.

The CI supports two event: merged pull request and workflow_dispatch.
The former only run after merging and latter is used to deploy by
maintainer manually. It also verifies whether any associated files
have changed. If so, carry out the CI; if not, stop.

Related: sysprog21#75
@ChinYikMing
Copy link
Collaborator Author

Please merge PR #388 first before merging this PR.

@ChinYikMing
Copy link
Collaborator Author
ChinYikMing commented Mar 27, 2024

Before merging this PR, please do the following to make the CI having permission:

  1. Generate a PAT with read and write permission (Settings --> Developer Settings --> Personal Access Tokens --> Tokens(classic) --> Generate New Tokens(classic))
  2. Store it in rv32emu's settings --> Secret and variables --> Actions --> Add a secret, and name it as RV32EMU_DEMO_TOKEN, the value is PAT which generated by previous step

@ChinYikMing
Copy link
Collaborator Author
ChinYikMing commented Mar 27, 2024

After merging this PR, please run the CI manually for the first time using workflow_dispatch event. Then, we should see the wasm deployed on rv32emu-demo

@jserv
Copy link
Contributor
jserv commented Mar 28, 2024

generate a PAT with read and write permission

Please indicate the minimal requirements for the scopes of the access for personal tokens such as write:package

@ChinYikMing
Copy link
Collaborator Author
ChinYikMing commented Mar 28, 2024

generate a PAT with read and write permission

Please indicate the minimal requirements for the scopes of the access for personal tokens such as write:package

Please select the permissions write:packages and read:packages(under write:packages).

@jserv jserv merged commit 92ffc1e into sysprog21:master Mar 28, 2024
@ChinYikMing ChinYikMing deleted the ci-deploy-wasm branch March 28, 2024 08:04
vestata pushed a commit to vestata/rv32emu that referenced this pull request Jan 24, 2025
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 4, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later, sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host's SDL backend. Now, it is time to bridge all these components
together.

Leverage xterm.js as the frontend terminal in the web browser and bridge
it with the backend VM shell through custom buffer management. This
mechanism handles both standard ASCII input and escape sequences
(such as arrow keys), providing a shell experience in the browser that
closely resembles a real terminal.

The SDL backend is also supported. After booting the guest Linux system,
can run doom-riscv, quake, or smolnes to experience graphical
applications. Can press Ctrl+C to exit SDL-based programs, or use their
built-in exit commands.

To reduce the size of the WASM file, the build is now separated into
user and system targets.
As a result, there are two HTML files:
- user.html
- system.html
and two corresponding preload JavaScript:
- user-pre.js and
- system-pre.js

Tested on latest Chrome, Firefox and Safari.
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 4, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later, sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host's SDL backend. Now, it is time to bridge all these components
together.

Leverage xterm.js as the frontend terminal in the web browser and bridge
it with the backend VM shell through custom buffer management. This
mechanism handles both standard ASCII input and escape sequences
(such as arrow keys), providing a shell experience in the browser that
closely resembles a real terminal.

The SDL backend is also supported. After booting the guest Linux system,
can run doom-riscv, quake, or smolnes to experience graphical
applications. Can press Ctrl+C to exit SDL-based programs, or use their
built-in exit commands.

To reduce the size of the WASM file, the build is now separated into
user and system targets.
As a result, there are two HTML files:
- user.html
- system.html
and two corresponding preload JavaScript:
- user-pre.js
- system-pre.js

Tested on latest Chrome, Firefox and Safari.
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 5, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later, sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host's SDL backend. Now, it is time to bridge all these components
together.

Leverage xterm.js as the frontend terminal in the web browser and bridge
it with the backend VM shell through custom buffer management. This
mechanism handles both standard ASCII input and escape sequences
(such as arrow keys), providing a shell experience in the browser that
closely resembles a real terminal.

The SDL backend is also supported. After booting the guest Linux system,
can run doom-riscv, quake, or smolnes to experience graphical
applications. Can press Ctrl+C to exit SDL-based programs, or use their
built-in exit commands.

To reduce the size of the WASM file, the build is now separated into
user and system targets.
As a result, there are two HTML files:
- user.html
- system.html
and two corresponding preload JavaScript:
- user-pre.js
- system-pre.js

Tested on latest Chrome, Firefox and Safari.
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 5, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host’s SDL backend. This commit bridges these components together to
enable full system emulation in the browser.

xterm.js is leveraged as the frontend terminal, bridged with the backend
VM shell through a custom buffer management mechanism. This mechanism
handles both standard ASCII input and escape sequences (such as arrow
keys), providing a shell experience in the browser that closely
resembles a real terminal.

To handle terminal input without blocking the browser’s cooperative
multitasking model, the original approach of mapping the read()
system call to window.prompt() is avoided. Blocking behavior would
freeze the browser’s event loop and degrade responsiveness. Instead,
input from xterm.js is stored in a shared input buffer. The rv32emu
periodically checks this buffer when handling external interrupts, and
if input is available, it is read and consumed by the guest OS shell.

The SDL graphic and sound backend are also supported. After booting the
guest Linux system, users can run graphical applications such as
doom-riscv, quake, or smolnes. These programs can be exited using
Ctrl+C or their built-in exit funtionality.

To reduce the size of the WebAssembly build and for the sake of the
modularity, the project is now separated into user and system targets.
As a result, two dedicated HTML files and corresponding preload
JavaScript files are introduced:
- user.html with user-pre.js
- system.html with system-pre.js

Navigation buttons are added to the index pages of both user and system
demos, allowing users to switch easily between the two modes.
Note that these navigation buttons are only functional when both user
and system demos are deployed t
10000
ogether, otherwise, the target pages may
not be reachable.
To improve usability, logic is implemented to disable and enable the
"Run" button at appropriate times, preventing accidental re-execution
when the process is already running.

Additional improvements:
- Ensure xterm.js uses \r\n instead of \n when logging to correctly move
the cursor to the beginning of the line.
- Add a new src/emsc.h header to store Emscripten-related variables and
function declarations for better management.

This implementation has been tested on the latest versions of Chrome,
Firefox, and Safari.

To serve user space emulation index page:
$ make start-web CC=emcc ENABLE_SDL=1 -j8

To serve system emulation index page:
$ make start-web CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j8
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 8, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host’s SDL backend. This commit bridges these components together to
enable full system emulation in the browser.

xterm.js is leveraged as the frontend terminal, bridged with the backend
VM shell through a custom buffer management mechanism. This mechanism
provides a shell experience in the browser that closely resembles a real
terminal.

To handle terminal input without blocking the browser’s cooperative
multitasking model, the original approach of mapping the read()
system call to window.prompt() is avoided. Blocking behavior would
freeze the browser’s event loop and degrade responsiveness. Instead,
input from xterm.js is stored in a shared input buffer. The rv32emu
periodically checks this buffer when handling external interrupts, and
if input is available, it is read and consumed by the guest OS shell.

The SDL graphic and sound backend are also supported. After booting the
guest Linux system, users can run graphical applications such as
doom-riscv, quake, or smolnes. These programs can be exited using
Ctrl+C or their built-in exit funtionality.

To reduce the size of the WebAssembly build and for the sake of the
modularity, the project is now separated into user and system targets.
As a result, two dedicated HTML files and corresponding preload
JavaScript files are introduced:
- user.html with user-pre.js
- system.html with system-pre.js

Navigation buttons are added to the index pages of both user and system
demos, allowing users to switch easily between the two modes.
Note that these navigation buttons are only functional when both user
and system demos are deployed together, otherwise, the target pages may
not be reachable.
To improve usability, logic is implemented to disable and enable the
"Run" button at appropriate times, preventing accidental re-execution
when the process is already running.

Additional improvements:
- Ensure xterm.js uses \r\n instead of \n when logging to correctly move
the cursor to the beginning of the line.
- Add a new src/emsc.h header to store Emscripten-related variables and
function declarations for better management.

This implementation has been tested on the latest versions of Chrome,
Firefox, and Safari.

To serve user space emulation index page:
$ make start-web CC=emcc ENABLE_SDL=1 -j8

To serve system emulation index page:
$ make start-web CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j8
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 13, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host’s SDL backend. This commit bridges these components together to
enable full system emulation in the browser.

xterm.js is leveraged as the frontend terminal, bridged with the backend
VM shell through a custom buffer management mechanism. This mechanism
provides a shell experience in the browser that closely resembles a real
terminal.

To handle terminal input without blocking the browser’s cooperative
multitasking model, the original approach of mapping the read()
system call to window.prompt() is avoided. Blocking behavior would
freeze the browser’s event loop and degrade responsiveness. Instead,
input from xterm.js is stored in a shared input buffer. The rv32emu
periodically checks this buffer when handling external interrupts, and
if input is available, it is read and consumed by the guest OS shell.

The SDL graphic and sound backend are also supported. After booting the
guest Linux system, users can run graphical applications such as
doom-riscv, quake, or smolnes. These programs can be exited using
Ctrl+C or their built-in exit funtionality.

To reduce the size of the WebAssembly build and for the sake of the
modularity, the project is now separated into user and system targets.
As a result, two dedicated HTML files and corresponding preload
JavaScript files are introduced:
- user.html with user-pre.js
- system.html with system-pre.js

Navigation buttons are added to the index pages of both user and system
demos, allowing users to switch easily between the two modes.
Note that these navigation buttons are only functional when both user
and system demos are deployed together, otherwise, the target pages may
not be reachable.
To improve usability, logic is implemented to disable and enable the
"Run" button at appropriate times, preventing accidental re-execution
when the process is already running.

Additional improvements:
- Ensure xterm.js uses \r\n instead of \n when logging to correctly move
the cursor to the beginning of the line.
- Add a new src/emsc.h,c to store Emscripten-related variables and
function declarations and implementations for better management.

This implementation has been tested on the latest versions of Chrome,
Firefox, and Safari.

To serve user space emulation index page:
$ make start-web CC=emcc ENABLE_SDL=1 -j8

To serve system emulation index page:
$ make start-web CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j8
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 13, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host’s SDL backend. This commit bridges these components together to
enable full system emulation in the browser.

xterm.js is leveraged as the frontend terminal, bridged with the backend
VM shell through a custom buffer management mechanism. This mechanism
provides a shell experience in the browser that closely resembles a real
terminal.

To handle terminal input without blocking the browser’s cooperative
multitasking model, the original approach of mapping the read()
system call to window.prompt() is avoided. Blocking behavior would
freeze the browser’s event loop and degrade responsiveness. Instead,
input from xterm.js is stored in a shared input buffer. The rv32emu
periodically checks this buffer when handling external interrupts, and
if input is available, it is read and consumed by the guest OS shell.

The SDL graphic and sound backend are also supported. After booting the
guest Linux system, users can run graphical applications such as
doom-riscv, quake, or smolnes. These programs can be exited using
Ctrl+C or their built-in exit funtionality.

To reduce the size of the WebAssembly build and for the sake of the
modularity, the project is now separated into user and system targets.
As a result, two dedicated HTML files and corresponding preload
JavaScript files are introduced:
- user.html with user-pre.js
- system.html with system-pre.js

Navigation buttons are added to the index pages of both user and system
demos, allowing users to switch easily between the two modes.
Note that these navigation buttons are only functional when both user
and system demos are deployed together, otherwise, the target pages may
not be reachable.
To improve usability, logic is implemented to disable and enable the
"Run" button at appropriate times, preventing accidental re-execution
when the process is already running.

Additional improvements:
- Ensure xterm.js uses \r\n instead of \n when logging to correctly move
the cursor to the beginning of the line.
- Add a new src/emsc.h,c to store Emscripten-related variables and
function declarations and implementations for better management.

This implementation has been tested on the latest versions of Chrome,
Firefox, and Safari.

To serve user space emulation index page:
$ make start-web CC=emcc ENABLE_SDL=1 -j8

To serve system emulation index page:
$ make start-web CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j8
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 13, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host’s SDL backend. This commit bridges these components together to
enable full system emulation in the browser.

xterm.js is leveraged as the frontend terminal, bridged with the backend
VM shell through a custom buffer management mechanism. This mechanism
provides a shell experience in the browser that closely resembles a real
terminal.

To handle terminal input without blocking the browser’s cooperative
multitasking model, the original approach of mapping the read()
system call to window.prompt() is avoided. Blocking behavior would
freeze the browser’s event loop and degrade responsiveness. Instead,
input from xterm.js is stored in a shared input buffer. The rv32emu
periodically checks this buffer when handling external interrupts, and
if input is available, it is read and consumed by the guest OS shell.

The SDL graphic and sound backend are also supported. After booting the
guest Linux system, users can run graphical applications such as
doom-riscv, quake, or smolnes. These programs can be exited using
Ctrl+C or their built-in exit funtionality.

To reduce the size of the WebAssembly build and for the sake of the
modularity, the project is now separated into user and system targets.
As a result, two dedicated HTML files and corresponding preload
JavaScript files are introduced:
- user.html with user-pre.js
- system.html with system-pre.js

Navigation buttons are added to the index pages of both user and system
demos, allowing users to switch easily between the two modes.
Note that these navigation buttons are only functional when both user
and system demos are deployed together, otherwise, the target pages may
not be reachable.
To improve usability, logic is implemented to disable and enable the
"Run" button at appropriate times, preventing accidental re-execution
when the process is already running.

Additional improvements:
- Ensure xterm.js uses \r\n instead of \n when logging to correctly move
the cursor to the beginning of the line.
- Add a new src/emsc.h,c to store Emscripten-related variables and
function declarations and implementations for better management.

This implementation has been tested on the latest versions of Chrome,
Firefox, and Safari.

To serve user space emulation index page:
$ make start-web CC=emcc ENABLE_SDL=1 -j8

To serve system emulation index page:
$ make start-web CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j8
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 13, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host’s SDL backend. This commit bridges these components together to
enable full system emulation in the browser.

xterm.js is leveraged as the frontend terminal, bridged with the backend
VM shell through a custom buffer management mechanism. This mechanism
provides a shell experience in the browser that closely resembles a real
terminal.

To handle terminal input without blocking the browser’s cooperative
multitasking model, the original approach of mapping the read()
system call to window.prompt() is avoided. Blocking behavior would
freeze the browser’s event loop and degrade responsiveness. Instead,
input from xterm.js is stored in a shared input buffer. The rv32emu
periodically checks this buffer when handling external interrupts, and
if input is available, it is read and consumed by the guest OS shell.

The SDL graphic and sound backend are also supported. After booting the
guest Linux system, users can run graphical applications such as
doom-riscv, quake, or smolnes. These programs can be exited using
Ctrl+C or their built-in exit funtionality.

To reduce the size of the WebAssembly build and for the sake of the
modularity, the project is now separated into user and system targets.
As a result, two dedicated HTML files and corresponding preload
JavaScript files are introduced:
- user.html with user-pre.js
- system.html with system-pre.js

Navigation buttons are added to the index pages of both user and system
demos, allowing users to switch easily between the two modes.
Note that these navigation buttons are only functional when both user
and system demos are deployed together, otherwise, the target pages may
not be reachable.
To improve usability, logic is implemented to disable and enable the
"Run" button at appropriate times, preventing accidental re-execution
when the process is already running.

Additional improvements:
- Ensure xterm.js uses \r\n instead of \n when logging to correctly move
the cursor to the beginning of the line.
- Add a new src/emsc.h,c to store Emscripten-related variables and
function declarations and implementations for better management.

This implementation has been tested on the latest versions of Chrome,
Firefox, and Safari.

To serve user space emulation index page:
$ make start-web CC=emcc ENABLE_SDL=1 -j8

To serve system emulation index page:
$ make start-web CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j8
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 13, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host’s SDL backend. This commit bridges these components together to
enable full system emulation in the browser.

xterm.js is leveraged as the frontend terminal, bridged with the backend
VM shell through a custom buffer management mechanism. This mechanism
provides a shell experience in the browser that closely resembles a real
terminal.

To handle terminal input without blocking the browser’s cooperative
multitasking model, the original approach of mapping the read()
system call to window.prompt() is avoided. Blocking behavior would
freeze the browser’s event loop and degrade responsiveness. Instead,
input from xterm.js is stored in a shared input buffer. The rv32emu
periodically checks this buffer when handling external interrupts, and
if input is available, it is read and consumed by the guest OS shell.

The SDL graphic and sound backend are also supported. After booting the
guest Linux system, users can run graphical applications such as
doom-riscv, quake, or smolnes. These programs can be exited using
Ctrl+C or their built-in exit funtionality.

To reduce the size of the WebAssembly build and for the sake of the
modularity, the project is now separated into user and system targets.
As a result, two dedicated HTML files and corresponding preload
JavaScript files are introduced:
- user.html with user-pre.js
- system.html with system-pre.js

Navigation buttons are added to the index pages of both user and system
demos, allowing users to switch easily between the two modes.
Note that these navigation buttons are only functional when both user
and system demos are deployed together, otherwise, the target pages may
not be reachable.
To improve usability, logic is implemented to disable and enable the
"Run" button at appropriate times, preventing accidental re-execution
when the process is already running.

Additional improvements:
- Ensure xterm.js uses \r\n instead of \n when logging to correctly move
the cursor to the beginning of the line.
- Add a new src/emsc.h,c to store Emscripten-related variables and
function declarations and implementations for better management.

This implementation has been tested on the latest versions of Chrome,
Firefox, and Safari.

To serve user space emulation index page:
$ make start-web CC=emcc ENABLE_SDL=1 -j8

To serve system emulation index page:
$ make start-web CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j8
ChinYikMing added a commit to ChinYikMing/rv32emu that referenced this pull request Jul 17, 2025
User-space emulation has been supported and deployable in WebAssembly
since sysprog21#389, but system emulation was not yet available. With sysprog21#508,
system emulation was introduced, and later sysprog21#551 added support for
trap-and-emulate of guest Linux SDL syscalls, enabling offloading to the
host’s SDL backend. This commit bridges these components together to
enable full system emulation in the browser.

xterm.js is leveraged as the frontend terminal, bridged with the backend
VM shell through a custom buffer management mechanism. This mechanism
provides a shell experience in the browser that closely resembles a real
terminal.

To handle terminal input without blocking the browser’s cooperative
multitasking model, the original approach of mapping the read()
system call to window.prompt() is avoided. Blocking behavior would
freeze the browser’s event loop and degrade responsiveness. Instead,
input from xterm.js is stored in a shared input buffer. The rv32emu
periodically checks this buffer when handling external interrupts, and
if input is available, it is read and consumed by the guest OS shell.

The SDL graphic and sound backend are also supported. After booting the
guest Linux system, users can run graphical applications such as
doom-riscv, quake, or smolnes. These programs can be exited using
Ctrl+C or their built-in exit funtionality.

To reduce the size of the WebAssembly build and for the sake of the
modularity, the project is now separated into user and system targets.
As a result, two dedicated HTML files and corresponding preload
JavaScript files are introduced:
- user.html with user-pre.js
- system.html with system-pre.js

Navigation buttons are added to the index pages of both user and system
demos, allowing users to switch easily between the two modes.
Note that these navigation buttons are only functional when both user
and system demos are deployed together, otherwise, the target pages may
not be reachable.
To improve usability, logic is implemented to disable and enable the
"Run" button at appropriate times, preventing accidental re-execution
when the process is already running.

Additional improvements:
- Ensure xterm.js uses \r\n instead of \n when logging to correctly move
the cursor to the beginning of the line.
- Add a new src/em_runtime.h,c to store Emscripten-related variables and
function declarations and implementations for better management.

This implementation has been tested on the latest versions of Chrome,
Firefox, and Safari.

To serve user space emulation index page:
$ make start-web CC=emcc ENABLE_SDL=1 -j8

To serve system emulation index page:
$ make start-web CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0