Skip to content

Commit

Permalink
chore: set up & build web app
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoDog896 committed Jun 1, 2024
1 parent 7a7c8b7 commit ef0f8de
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 17 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ jobs:
run: |
cp book/banner.webp dist/banner.webp
cp book/landing.html dist/index.html
- name: Download and install Trunk binary
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
- name: Build Web App
run: ./trunk build --release --public-url $public_url
working-directory: crates/games-ui
env:
public_url: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/app"
- name: Copy Web App
run: |
mkdir dist/app
cp -r ./crates/games-ui/dist/*
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/target
/book/book
/dist
dist
/doc

# performance
Expand Down
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/game-solver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ edition = "2021"
"xxhash" = ["dep:twox-hash"]
"rayon" = ["dep:rayon", "xxhash", "dep:sysinfo", "dep:moka"]
"reinforcement" = ["dep:rand", "dep:dfdx", "dep:itertools"]
"js" = ["moka/js"]

[dependencies]
dfdx = { git = "https://github.com/coreylowman/dfdx.git", rev = "4722a99", optional = true }
Expand Down
10 changes: 9 additions & 1 deletion crates/games-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@ eframe = { version = "0.27.2", default-features = false, features = [
"persistence"
]}
egui = "0.27"
game-solver = { path = "../game-solver", features = ["rayon", "reinforcement"] }
serde = { version = "1", features = ["derive"] }
log = "0.4"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
env_logger = "0.11"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-futures = "0.4"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.game-solver]
path = "../game-solver"
features = ["rayon", "reinforcement"]

[target.'cfg(target_arch = "wasm32")'.dependencies.game-solver]
path = "../game-solver"
features = ["rayon", "reinforcement", "js"]
15 changes: 1 addition & 14 deletions crates/games-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,7 @@
<link data-trunk rel="rust" data-wasm-opt="2" />
<!-- this is the base url relative to which other urls will be constructed. trunk will insert this from the public-url option -->
<base data-trunk-public-url />

<link data-trunk rel="icon" href="assets/favicon.ico">


<link data-trunk rel="copy-file" href="assets/sw.js" />
<link data-trunk rel="copy-file" href="assets/manifest.json" />
<link data-trunk rel="copy-file" href="assets/icon-1024.png" />
<link data-trunk rel="copy-file" href="assets/icon-256.png" />
<link data-trunk rel="copy-file" href="assets/icon_ios_touch_192.png" />
<link data-trunk rel="copy-file" href="assets/maskable_icon_x512.png" />


<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" href="icon_ios_touch_192.png">

<meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#404040">

Expand Down
2 changes: 1 addition & 1 deletion crates/games-ui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn main() {
.start(
"the_canvas_id", // hardcode it
web_options,
Box::new(|cc| Box::new(eframe_template::TemplateApp::new(cc))),
Box::new(|cc| Box::new(games_ui::TemplateApp::new(cc))),
)
.await
.expect("failed to start eframe");
Expand Down

0 comments on commit ef0f8de

Please sign in to comment.