Skip to content

Commit 95092be

Browse files
Merge pull request RustPython#225 from RustPython/test-demo
Fixed the travis build for deploying the demo page
2 parents b46fc93 + 0159051 commit 95092be

3 files changed

Lines changed: 11 additions & 23 deletions

File tree

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,19 @@ matrix:
7070
if: branch = release
7171
env:
7272
- REGULAR_TEST=false
73-
- PUBLISH_DOC=true
7473
- name: WASM online demo
7574
language: rust
7675
rust: nightly
7776
cache: cargo
77+
install:
78+
- nvm install node
79+
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh # install wasm-pack
7880
script:
7981
- cd wasm
8082
- bash release.sh
8183
if: branch = release
8284
env:
8385
- REGULAR_TEST=false
84-
- PUBLISH_DEMO=true
8586
allow_failures:
8687
- rust: nightly
8788
env: REGULAR_TEST=true
@@ -96,7 +97,6 @@ deploy:
9697
keep-history: true
9798
on:
9899
branch: release
99-
condition: $PUBLISH_DOC = true
100100
- provider: pages
101101
repo: RustPython/demo
102102
target-branch: master
@@ -106,4 +106,3 @@ deploy:
106106
keep-history: true
107107
on:
108108
branch: release
109-
condition: $PUBLISH_DEMO = true

README.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ At this stage RustPython only has preliminary support for web assembly. The inst
115115

116116
## Setup
117117

118-
To get started, install [wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/whirlwind-tour/basic-usage.html)
119-
and [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/). You will also need to have `npm` installed.
118+
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)
120119

121120
<!-- Using `rustup` add the compile target `wasm32-unknown-emscripten`. To do so you will need to have [rustup](https://rustup.rs/) installed.
122121
@@ -134,8 +133,6 @@ cd emsdk-portable/
134133
./emsdk activate sdk-incoming-64bit
135134
``` -->
136135

137-
138-
139136
## Build
140137

141138
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
144141
cd wasm
145142
```
146143

147-
From here run the build. This can take several minutes depending on the machine.
144+
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`.
145+
146+
If you don't want to use the above scripts, you can do it manually as follows:
147+
148+
Run the build. This can take several minutes depending on the machine.
148149

149150
```
150151
wasm-pack build
@@ -171,19 +172,7 @@ and you will be able to run the files with:
171172
node_modules/.bin/webpack-dev-server
172173
```
173174

174-
Open a browser console and see the output of rustpython_wasm. To verify this, modify the line in `app/index.js`
175-
176-
```js
177-
rp.run_code("print('Hello Python!')\n");
178-
```
179-
180-
To the following:
181-
182-
```js
183-
rp.run_code("assert(False)\n");
184-
```
185-
186-
and you should observe: `Execution failed` in your console output, indicating that the execution of RustPython has failed.
175+
Now open the webpage on https://localhost:8080, you'll be able to run Python code in the text box.
187176

188177
# Code style
189178

wasm/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ npm link && \
44
cd ../app && \
55
npm install && \
66
npm link rustpython_wasm && \
7-
webpack --mode production && \
7+
node_modules/.bin/webpack --mode production && \
88
echo "Output saved to app/dist"

0 commit comments

Comments
 (0)