Skip to content

Commit e27a07a

Browse files
authored
Add Github actions (#1)
* try wasm-pack-actions * test uploading * Fix release command * add permissions * Add secrets * remove unnecessary permissions * add deploy action * publish files under dist * Add link to github
1 parent eb79f78 commit e27a07a

File tree

3 files changed

+54
-46
lines changed

3 files changed

+54
-46
lines changed

.github/workflows/build-page.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build-page
2+
on:
3+
release:
4+
types:
5+
- created
6+
jobs:
7+
build:
8+
env:
9+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
name: build
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: jetli/[email protected]
15+
with:
16+
version: "latest"
17+
- uses: borales/[email protected]
18+
with:
19+
cmd: install # will run `yarn install` command
20+
- run: |
21+
yarn wasm && yarn build
22+
- name: Release
23+
run: |
24+
gh release upload ${GITHUB_REF##*/} dist/index.html'#Single HTML Relase artifact' --clobber
25+
- name: Deploy
26+
uses: peaceiris/actions-gh-pages@v3
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
publish_dir: ./dist
30+
allow_empty_commit: true

App.vue

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ canvas {
77
<v-app>
88
<v-app-bar app flat>
99
<v-toolbar-title> Bayesian Binomial Test Calculator</v-toolbar-title>
10+
<v-spacer> </v-spacer>
11+
<v-toolbar-items>
12+
<v-btn text class="text-capitalize" href="https://github.com/tohtsky/bayesian-binomial-test">
13+
<v-icon> mdi-github</v-icon>
14+
&nbsp; Source code
15+
</v-btn>
16+
</v-toolbar-items>
1017
</v-app-bar>
1118
<v-main>
1219
<v-container>
@@ -15,22 +22,12 @@ canvas {
1522
<v-container>
1623
<v-row>
1724
<v-col cols="12">
18-
<Group
19-
v-model="a"
20-
groupName="A"
21-
:posInitial="30"
22-
:totInitial="100"
23-
></Group>
25+
<Group v-model="a" groupName="A" :posInitial="30" :totInitial="100"></Group>
2426
</v-col>
2527
</v-row>
2628
<v-row>
2729
<v-col cols="12">
28-
<Group
29-
v-model="b"
30-
groupName="B"
31-
:posInitial="b_init.pos"
32-
:totInitial="b_init.tot"
33-
></Group>
30+
<Group v-model="b" groupName="B" :posInitial="b_init.pos" :totInitial="b_init.tot"></Group>
3431
</v-col>
3532
</v-row>
3633
<v-row>
@@ -40,28 +37,16 @@ canvas {
4037
<v-card-text>
4138
<v-row>
4239
<v-col cols="6">
43-
<v-text-field
44-
label="alpha"
45-
type="Number"
46-
:error-messages="alphaError"
47-
v-model.number="alpha"
48-
></v-text-field>
40+
<v-text-field label="alpha" type="Number" :error-messages="alphaError" v-model.number="alpha">
41+
</v-text-field>
4942
</v-col>
5043
<v-col cols="6">
51-
<v-text-field
52-
label="beta"
53-
type="Number"
54-
v-model.number="beta"
55-
:error-messages="betaError"
56-
></v-text-field>
44+
<v-text-field label="beta" type="Number" v-model.number="beta" :error-messages="betaError">
45+
</v-text-field>
5746
</v-col>
5847
<v-col cols="6">
59-
<v-text-field
60-
label="Number of samples"
61-
type="Number"
62-
v-model.number="nSamples"
63-
:error-messages="nSamplesError"
64-
></v-text-field>
48+
<v-text-field label="Number of samples" type="Number" v-model.number="nSamples"
49+
:error-messages="nSamplesError"></v-text-field>
6550
</v-col>
6651
</v-row>
6752
</v-card-text>
@@ -70,11 +55,7 @@ canvas {
7055
</v-row>
7156
</v-container>
7257
</v-col>
73-
<v-col
74-
cols="12"
75-
lg="8"
76-
:style="{ opacity: payload === null ? 0.4 : 1.0 }"
77-
>
58+
<v-col cols="12" lg="8" :style="{ opacity: payload === null ? 0.4 : 1.0 }">
7859
<v-row>
7960
<v-col cols="12">
8061
<div class="text-center pt-4 text-h5">
@@ -84,20 +65,12 @@ canvas {
8465
<v-row class="pt-4">
8566
<v-col cols="1"></v-col>
8667
<v-col cols="10">
87-
<canvas
88-
ref="canvas_a_b"
89-
:width="800 * dpr"
90-
:height="300 * dpr"
91-
></canvas>
68+
<canvas ref="canvas_a_b" :width="800 * dpr" :height="300 * dpr"></canvas>
9269
</v-col>
9370
<v-col cols="1"></v-col>
9471
<v-col cols="1"></v-col>
9572
<v-col cols="10">
96-
<canvas
97-
ref="canvas_diff"
98-
:width="800 * dpr"
99-
:height="300 * dpr"
100-
></canvas>
73+
<canvas ref="canvas_diff" :width="800 * dpr" :height="300 * dpr"></canvas>
10174
</v-col>
10275
<v-col cols="1"></v-col>
10376
</v-row>

ReadMe.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Bayesian binomial test using WebAssembly
22

3+
[**Demo**](https://tohtsky.github.io/bayesian-binomial-test/)
4+
5+
36
A/B test significance judgement using bayesian beta-binomial distribution is simple. In Python, we can do that like:
47
```python
58
import numpy as np
@@ -26,4 +29,6 @@ posterior_b = rng.beta(alpha_prior + n_success_b, beta_prior + n_events_b - n_su
2629

2730
This simple demo visualizes the Bayesian binomial test, using Rust + WebAssembly to sample from the posterior distribution (obviously overkill, but fun).
2831

29-
You can find a similar example app [here](https://making.lyst.com/bayesian-calculator/).
32+
This should work off-line. Get a single HTML file from [the latest release](https://github.com/tohtsky/bayesian-binomial-test/releases/latest).
33+
34+
A similar application that influcend this project can be found [here](https://making.lyst.com/bayesian-calculator/).

0 commit comments

Comments
 (0)