Skip to content

Commit

Permalink
build: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
simbleau committed Apr 15, 2024
0 parents commit 887ce9e
Show file tree
Hide file tree
Showing 14 changed files with 2,091 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[target.wasm32-unknown-unknown]
runner = "wasm-server-runner"
[target.'cfg(target_family = "wasm")']
rustflags = ["--cfg=web_sys_unstable_apis"]
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI
on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v4

- name: Setup | Toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Build | Clippy
run: cargo clippy -- -D warnings

- name: Build | Rustfmt
run: cargo fmt --all -- --check

check:
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v4

- name: Setup | Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Build | Check (native)
run: cargo check

- name: Build | Check (wasm)
run: cargo check --target wasm32-unknown-unknown

test:
needs: [check]
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v4

- name: Setup | Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Setup | wasm-pack
uses: jetli/[email protected]

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Build | Test (native)
run: cargo test --all

- name: Build | Test (wasm)
run: wasm-pack test --node
67 changes: 67 additions & 0 deletions .github/workflows/web-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Web Demo Update

on:
push:
branches:
- main

jobs:
release-web:
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: install wasm-bindgen
uses: jetli/[email protected]
with:
version: 'latest'

- name: build (wasm)
run: cargo build --example simple --release --target wasm32-unknown-unknown

- name: package wasm
run: |
mkdir public
wasm-bindgen --target web --out-dir public target/wasm32-unknown-unknown/release/examples/simple.wasm --no-typescript
cat << EOF > public/index.html
<html>
<title>WebGPU Check Demo</title>
<meta content=no-cache http-equiv=Cache-control>
<meta content=-1 http-equiv=Expires>
<script>let wasmModule;</script>
<script type="module">
import initSync from "/webgpu_check/simple.js";
wasmModule = await initSync(`/webgpu_check/simple_bg.wasm`);
</script>
<link as=fetch crossorigin href=/webgpu_check/simple_bg.wasm rel=preload type=application/wasm>
<link crossorigin href=/webgpu_check/simple.js rel=modulepreload>
</head>
<body>
This application needs JavaScript and WebAssembly to run.
</body>
</html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './public'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

<!-- Instructions
This changelog follows the patterns described here: <https://keepachangelog.com/en/1.0.0/>.
Subheadings to categorize changes are `added, changed, deprecated, removed, fixed, security`.
-->

## Unreleased

## 0.1.0

- Initialize release
Loading

0 comments on commit 887ce9e

Please sign in to comment.