Skip to content

Commit 1be0a1e

Browse files
authored
Merge pull request #7 from topheman/feat/pre-release-upload-wasm
Add Pre-release Workflow with WASM File Uploads
2 parents 6b17d9e + d280587 commit 1be0a1e

File tree

5 files changed

+122
-2
lines changed

5 files changed

+122
-2
lines changed

.github/workflows/rust-host.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,26 @@ name: rust-host
22
on: [push, pull_request]
33

44
jobs:
5+
# https://github.com/marketplace/actions/skip-duplicate-actions
6+
pre_job:
7+
# continue-on-error: true # Uncomment once integration is finished
8+
runs-on: ubuntu-latest
9+
# Map a step output to a job output
10+
outputs:
11+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
12+
steps:
13+
- id: skip_check
14+
uses: fkirc/skip-duplicate-actions@v5
15+
with:
16+
# All of these options are optional, so you can remove them if you are happy with the defaults
17+
# Skip a workflow run if the same workflow is already running
18+
concurrent_skipping: 'same_content_newer'
19+
skip_after_successful_duplicate: 'true'
20+
paths_ignore: '["**/README.md"]'
21+
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
522
build-and-test:
23+
needs: pre_job
24+
if: needs.pre_job.outputs.should_skip != 'true'
625
runs-on: ubuntu-latest
726
steps:
827
- name: Set variables based on OS and architecture for just dl-wasi-sdk
@@ -43,3 +62,35 @@ jobs:
4362
run: just test
4463
- name: Test with wasm from http server (if it fails, you need to publish a new version of pluginlab)
4564
run: just test-e2e-pluginlab-http
65+
66+
- name: Build plugins in release mode (for pre-release)
67+
if: github.ref_type == 'tag'
68+
run: just build-plugins-release
69+
- name: Prepare wasm files (for pre-release)
70+
if: github.ref_type == 'tag'
71+
run: ./scripts/prepare-wasm-files.sh --mode release --target-dir ./tmp/plugins
72+
- name: Cache wasm files (for pre-release)
73+
if: github.ref_type == 'tag'
74+
id: cache-wasm-files
75+
uses: actions/cache@v4
76+
with:
77+
path: ./tmp/plugins
78+
key: ${{ runner.os }}-wasm-files-${{ github.sha }}
79+
80+
pre-release:
81+
if: github.ref_type == 'tag'
82+
permissions:
83+
contents: write
84+
runs-on: ubuntu-latest
85+
needs: build-and-test
86+
steps:
87+
- name: Restore cached wasm files
88+
id: cache-wasm-files-restore
89+
uses: actions/cache/restore@v4
90+
with:
91+
path: ./tmp/plugins
92+
key: ${{ runner.os }}-wasm-files-${{ github.sha }}
93+
- name: Pre-release
94+
uses: softprops/action-gh-release@v2
95+
with:
96+
files: ./tmp/plugins/*.wasm

.github/workflows/web-host.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,26 @@ name: web-host
22
on: [push, pull_request]
33

44
jobs:
5+
# https://github.com/marketplace/actions/skip-duplicate-actions
6+
pre_job:
7+
# continue-on-error: true # Uncomment once integration is finished
8+
runs-on: ubuntu-latest
9+
# Map a step output to a job output
10+
outputs:
11+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
12+
steps:
13+
- id: skip_check
14+
uses: fkirc/skip-duplicate-actions@v5
15+
with:
16+
# All of these options are optional, so you can remove them if you are happy with the defaults
17+
# Skip a workflow run if the same workflow is already running
18+
concurrent_skipping: 'same_content_newer'
19+
skip_after_successful_duplicate: 'true'
20+
paths_ignore: '["**/README.md"]'
21+
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
522
build:
23+
needs: pre_job
24+
if: needs.pre_job.outputs.should_skip != 'true'
625
runs-on: ubuntu-latest
726
steps:
827
- name: Set variables based on OS and architecture for just dl-wasi-sdk

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,35 @@ More about the [SpiderMonkey runtime embedding](https://github.com/bytecodeallia
357357

358358
Coming.
359359

360+
## CI
361+
362+
### Testing
363+
364+
The `pluginlab` binary is built and tested e2e (using `rexpect` library).
365+
366+
The `web-host` is built and tested e2e (using [playwright](https://playwright.dev/)).
367+
368+
### Deployment
369+
370+
The `web-host` is automatically deployed to github pages when pushed on the `master` branch, containing the latest `wasm` versions of the plugins available at https://topheman.github.io/webassembly-component-model-experiments/plugins.
371+
372+
### Pre-release
373+
374+
https://github.com/topheman/webassembly-component-model-experiments/releases
375+
376+
When a git tag is pushed, a pre-release is prepared on github, linked to the tag, containing the `wasm` files for the plugins and the repl-logic, in order to version those. That way, you can use an old binary of `pluginlab` against the correct versions of the plugins:
377+
378+
```sh
379+
pluginlab\
380+
--repl-logic https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/repl_logic_guest.wasm\
381+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_greet.wasm\
382+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_ls.wasm\
383+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_echo.wasm\
384+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_weather.wasm\
385+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_cat.wasm\
386+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin-echo-c.wasm\
387+
--allow-all
388+
```
360389

361390
## Developer experience
362391

crates/pluginlab/README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ cargo install pluginlab
5151

5252
## Usage
5353

54-
Run the CLI host, loading the plugins from the web (you can also load them from local files).
54+
Run the CLI host, loading the latest versions of the plugins from the web (you can also load them from local files).
5555

5656
```bash
5757
pluginlab\
@@ -75,7 +75,6 @@ Other flags:
7575
- `--help`: displays manual
7676
- `--debug`: run the host in debug mode (by default, the host runs in release mode)
7777

78-
7978
<details>
8079
<summary>🚀 Example of running the CLI host</summary>
8180
<pre>
@@ -124,3 +123,23 @@ Hello, Tophe!
124123
repl(0)>
125124
</pre>
126125
</details>
126+
127+
### Versioning
128+
129+
The plugins are also versioned in [github releases](https://github.com/topheman/webassembly-component-model-experiments/releases), you can use them if you want to use an old version of the plugins.
130+
131+
<summary>
132+
<details>
133+
<summary>Example of running the CLI host with old versions of the plugins (if you have an old version of <code>pluginlab</code></summary>
134+
<pre>
135+
pluginlab\
136+
--repl-logic https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/repl_logic_guest.wasm\
137+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_greet.wasm\
138+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_ls.wasm\
139+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_echo.wasm\
140+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_weather.wasm\
141+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin_cat.wasm\
142+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.4.1/plugin-echo-c.wasm\
143+
--allow-all
144+
</pre>
145+
</summary>

justfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ build-release: build-repl-logic-guest-release build-plugins-release build-c-plug
6767
# Build all plugins in debug mode
6868
build-plugins:
6969
#!/usr/bin/env bash
70+
just build-repl-logic-guest
7071
just build-rust-plugins
7172
just build-c-plugins
7273

7374
# Build all plugins in release mode
7475
build-plugins-release:
7576
#!/usr/bin/env bash
77+
just build-repl-logic-guest-release
7678
just build-rust-plugins-release
7779
just build-c-plugins
7880

0 commit comments

Comments
 (0)