Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1c47e54
fix(webgpu): implement canvas surface creation for WebAssembly target
Apr 19, 2025
bb1ba4a
feat(webgpu): implement animated Earth globe rendering
Apr 19, 2025
e7788c9
feat(earth): textured globe rendering with downscaled JPEG and WGSL s…
Apr 20, 2025
2d4f4bf
chore: remove temp/build artifacts from repo and update .gitignore
Apr 20, 2025
075fb11
feat: add static file deployment to GCS bucket
Apr 21, 2025
2512d3e
feat: use static files from gcs bucket
Apr 21, 2025
1f0bafe
fix(webgpu): update API calls for canvas surface creation and rendering
May 5, 2025
a7f6422
fix(webapp): proper Three.js integration with wasm-bindgen
May 5, 2025
3265af2
feat(threejs): implement ThreeJs integration with spinning cube
May 5, 2025
acd0e98
refactor(three.js): improve WebGLRenderer and MeshBasicMaterial param…
May 5, 2025
79b954c
refactor(earth): refactor globe.rs to follow Rust-idiomatic approach
May 6, 2025
6d6c58a
fix: create basic red sphere with black background for Three.js globe
May 6, 2025
c174cc2
fix(texture): implement texture loading with gloo_timers
May 7, 2025
7165a98
fix(three_js): implement pure Rust texture loading with callbacks
May 7, 2025
1ae4bc8
refactor: simplify the binding
May 8, 2025
18c2c62
fix: match orbit and planet rotation behavior with original frontend
May 8, 2025
08f1ffb
chore: cleanup Dioxus config and html title
May 8, 2025
5e21c2b
refactor: implement repository pattern for country management
May 8, 2025
af195dd
style: adjust button padding
May 8, 2025
1397cf9
refactor: clean up codebase and improve components
May 8, 2025
88d90a3
refactor: remove unused viewer module
May 8, 2025
9d10bec
chore: cleanup components
May 8, 2025
d35d72b
ci: update build workflow for wasm and native targets
May 8, 2025
5e78fe1
ci: update action versions and add digests
May 8, 2025
27e19e6
ci: split build into native and webassembly jobs
May 8, 2025
348b630
ci: add protoc installation to webassembly job
May 8, 2025
a03dbac
ci: optimize build speed with caching
May 8, 2025
7190e47
ci: fix wasm packaging by using clickplanet-webapp/dist
May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
"name": "Rust",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",

// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
// "mounts": [
// {
// "source": "devcontainer-cargo-cache-${devcontainerId}",
// "target": "/usr/local/cargo",
// "type": "volume"
// }
// ]

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/devcontainers-extra/features/sbt-sdkman:2": {},
"ghcr.io/devcontainers-extra/features/spark-sdkman:2": {},
"ghcr.io/devcontainers-extra/features/protoc:1": {}
}

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
108 changes: 76 additions & 32 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,110 @@ on:
- main

jobs:
build:
name: Build and Test
native:
name: Build and Test Native
runs-on: ubuntu-latest

steps:
# Step 1. Checkout the Repository
- name: Checkout code
uses: actions/checkout@v3

# Step 2. Install Protocol Buffers Compiler (protoc)
- name: Install Protobuf Compiler (protoc)
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
protoc --version # Print protoc version to confirm installation
protoc --version

# Step 3. Install Rust (via rustup)
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy # Install supplementary tools
components: rustfmt, clippy
override: true

# Step 4. Install Cargo Dependencies
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-native-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-native-

- name: Install dependencies
run: |
cargo fetch

# Step 5. Build the Project
- name: Build the project
- name: Build native project
run: |
cargo build --verbose --workspace
cargo build --verbose --workspace --exclude clickplanet-webapp

# Step 6. Run Tests
- name: Run tests
- name: Run native tests
run: |
cargo test --verbose --workspace
cargo test --verbose --workspace --exclude clickplanet-webapp

# Step 6. Run Build for WebAssembly frontend
- name: Install Trunk
run: |
cargo install trunk --locked

- name: Install wasm32 target
webassembly:
name: Build WebAssembly
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.sha }}

- name: Setup Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: stable
target: wasm32-unknown-unknown
components: rustfmt, clippy
override: true

- name: Install Protobuf Compiler (protoc)
run: |
rustup target add wasm32-unknown-unknown

- name: Build WebAssembly with Trunk
sudo apt-get update
sudo apt-get install -y protobuf-compiler
protoc --version

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-wasm-

- name: Install Dioxus CLI
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: dioxus-cli

- name: Build WebAssembly with Dioxus
env:
CITYWARS_STATIC_SITE: "https://storage.googleapis.com/lv-project-313715-clickwars-static/static"
RUSTFLAGS: "--cfg=web_sys_unstable_apis"
run: |
cd clickplanet-webapp
trunk build --release

# Step 7. Lint and Format (Optional)
# - name: Run Clippy (Lint)
# run: |
# cargo clippy --workspace --all-targets --all-features -- -D warnings
# - name: Check formatting
# run: |
# cargo fmt --all -- --check
dx build --release
mkdir -p dist
cp -r ../target/dx/clickplanet-webapp/release/web/public/* dist/

- name: Package WASM
run: |
cd clickplanet-webapp/dist
tar czf ../../clickplanet-webapp.tar.gz .

- name: Upload WASM Package
uses: actions/upload-artifact@v4
with:
name: clickplanet-webapp
path: clickplanet-webapp.tar.gz

docker:
name: Build Docker Images
Expand Down
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,14 @@ log4j.properties

# Local utility scripts
**/analyze-*.sh
**/cleanup-*.sh
**/cleanup-*.sh

# ignore boa history
.boa_history
# ignore Python bytecode and cache dirs
*.pyc
__pycache__/
# ignore Metals build files
metals.sbt
# ignore npm lock file
package-lock.json
27 changes: 18 additions & 9 deletions .windsurfrules
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,28 @@ And finally: Always use the edit tool. If it does not work, read the file first
Make sure we use conventional commits
Do not use interactive rebase (you are an LLM). If a git MCP server does rebases, use it.

Try to use trunk hot reload. It is does not work, instead of allocating a new port, kill the older trunk instances.
Do not use docker build when building locally.

CITYWARS_STATIC_SITE="https://storage.googleapis.com/lv-project-313715-clickwars-static/static" is the right environnement variable to place in front of RUSTFLAGS="--cfg=web_sys_unstable_apis" cargo build --target wasm32-unknown-unknown or dx serve command.

the frontend implementation is here: ./original-frontend
the backend implementation is here: ./original-backend

The download/upload script should use the bucket that is listed in the gcloud storage ls command.
Do not modify production code for testing purposes, use environment variables instead.
Pay attention to the environment variables you are using.
When designing the download/upload script, please take the size of the file in account (70 GB) and the nature of aria2. Which means, we should have enough place on the disk and the memory and we should write concurrently.
Also please when creating a download volume, think about deleting it after the operation.
Avoid using download-job/ directory for creating temporary files.
Do not use memory mount, since we are dealing with a 70 GB file.

Please read the documentation carefully.

Don't put fucking useless comments that are exact duplicates of the code.
Don't put fucking useless comments that are exact duplicates of the code.

Briefly explain what you are doing instead of just calling the tools.

When compiling the webapp, the chain should be wasm, and not local machine one.

When you launch a command use the Windsurf terminal API so that I can kill or stop a process by myself.

When downloading a cargo or js or sbt dependency, check the latest one using your browser tools, before guessing. Your memory is not up to date.

When I say, read the public docs, or review the public docs, you have to do it and use the fucking documentation or the source code of the project.

Do not launch dx serve yourself. I will do it.

Don't make JS code if you can do the same with rust and wasm. Use gloo: timers, utils, etc
Loading
Loading