mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Merge pull request #225 from RustPython/test-demo
Fixed the travis build for deploying the demo page
This commit is contained in:
@@ -70,18 +70,19 @@ matrix:
|
||||
if: branch = release
|
||||
env:
|
||||
- REGULAR_TEST=false
|
||||
- PUBLISH_DOC=true
|
||||
- name: WASM online demo
|
||||
language: rust
|
||||
rust: nightly
|
||||
cache: cargo
|
||||
install:
|
||||
- nvm install node
|
||||
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh # install wasm-pack
|
||||
script:
|
||||
- cd wasm
|
||||
- bash release.sh
|
||||
if: branch = release
|
||||
env:
|
||||
- REGULAR_TEST=false
|
||||
- PUBLISH_DEMO=true
|
||||
allow_failures:
|
||||
- rust: nightly
|
||||
env: REGULAR_TEST=true
|
||||
@@ -96,7 +97,6 @@ deploy:
|
||||
keep-history: true
|
||||
on:
|
||||
branch: release
|
||||
condition: $PUBLISH_DOC = true
|
||||
- provider: pages
|
||||
repo: RustPython/demo
|
||||
target-branch: master
|
||||
@@ -106,4 +106,3 @@ deploy:
|
||||
keep-history: true
|
||||
on:
|
||||
branch: release
|
||||
condition: $PUBLISH_DEMO = true
|
||||
|
||||
25
README.md
25
README.md
@@ -115,8 +115,7 @@ At this stage RustPython only has preliminary support for web assembly. The inst
|
||||
|
||||
## Setup
|
||||
|
||||
To get started, install [wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/whirlwind-tour/basic-usage.html)
|
||||
and [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/). You will also need to have `npm` installed.
|
||||
To get started, install [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) and `npm`. ([wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/whirlwind-tour/basic-usage.html) should be installed by `wasm-pack`. if not, install it yourself)
|
||||
|
||||
<!-- Using `rustup` add the compile target `wasm32-unknown-emscripten`. To do so you will need to have [rustup](https://rustup.rs/) installed.
|
||||
|
||||
@@ -134,8 +133,6 @@ cd emsdk-portable/
|
||||
./emsdk activate sdk-incoming-64bit
|
||||
``` -->
|
||||
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
Move into the `wasm` directory. This contains a custom library crate optimized for wasm build of RustPython.
|
||||
@@ -144,7 +141,11 @@ Move into the `wasm` directory. This contains a custom library crate optimized f
|
||||
cd wasm
|
||||
```
|
||||
|
||||
From here run the build. This can take several minutes depending on the machine.
|
||||
For testing on a development server, you can run the `build.sh` script. For release build which generates files for deploying to a HTTP server, run `release.sh`.
|
||||
|
||||
If you don't want to use the above scripts, you can do it manually as follows:
|
||||
|
||||
Run the build. This can take several minutes depending on the machine.
|
||||
|
||||
```
|
||||
wasm-pack build
|
||||
@@ -171,19 +172,7 @@ and you will be able to run the files with:
|
||||
node_modules/.bin/webpack-dev-server
|
||||
```
|
||||
|
||||
Open a browser console and see the output of rustpython_wasm. To verify this, modify the line in `app/index.js`
|
||||
|
||||
```js
|
||||
rp.run_code("print('Hello Python!')\n");
|
||||
```
|
||||
|
||||
To the following:
|
||||
|
||||
```js
|
||||
rp.run_code("assert(False)\n");
|
||||
```
|
||||
|
||||
and you should observe: `Execution failed` in your console output, indicating that the execution of RustPython has failed.
|
||||
Now open the webpage on https://localhost:8080, you'll be able to run Python code in the text box.
|
||||
|
||||
# Code style
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ npm link && \
|
||||
cd ../app && \
|
||||
npm install && \
|
||||
npm link rustpython_wasm && \
|
||||
webpack --mode production && \
|
||||
node_modules/.bin/webpack --mode production && \
|
||||
echo "Output saved to app/dist"
|
||||
|
||||
Reference in New Issue
Block a user