Skip to content

Commit ab40c10

Browse files
authored
Initial commit
0 parents  commit ab40c10

21 files changed

+3911
-0
lines changed

.cargo/config.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# clipboard api is still unstable, so web-sys requires the below flag to be passed for copy (ctrl + c) to work
2+
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
3+
# check status at https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
4+
# we don't use `[build]` because of rust analyzer's build cache invalidation https://github.com/emilk/eframe_template/issues/93
5+
[target.wasm32-unknown-unknown]
6+
rustflags = ["--cfg=web_sys_unstable_apis"]

.github/workflows/pages.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Github Pages
2+
3+
# By default, runs if you push to master. keeps your deployed app in sync with master branch.
4+
on:
5+
push:
6+
branches:
7+
- master
8+
# to only run when you do a new github release, comment out above part and uncomment the below trigger.
9+
# on:
10+
# release:
11+
# types:
12+
# - published
13+
14+
permissions:
15+
contents: write # for committing to gh-pages branch.
16+
17+
jobs:
18+
build-github-pages:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2 # repo checkout
22+
- uses: actions-rs/toolchain@v1 # get rust toolchain for wasm
23+
with:
24+
profile: minimal
25+
toolchain: stable
26+
target: wasm32-unknown-unknown
27+
override: true
28+
- name: Rust Cache # cache the rust build artefacts
29+
uses: Swatinem/rust-cache@v1
30+
- name: Download and install Trunk binary
31+
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
32+
- name: Build # build
33+
# "${GITHUB_REPOSITORY#*/}" evaluates into the name of the repository
34+
# using --public-url something will allow trunk to modify all the href paths like from favicon.ico to repo_name/favicon.ico .
35+
# this is necessary for github pages where the site is deployed to username.github.io/repo_name and all files must be requested
36+
# relatively as eframe_template/favicon.ico. if we skip public-url option, the href paths will instead request username.github.io/favicon.ico which
37+
# will obviously return error 404 not found.
38+
run: ./trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"
39+
- name: Deploy
40+
uses: JamesIves/github-pages-deploy-action@v4
41+
with:
42+
folder: dist
43+
# this option will not maintain any history of your previous pages deployment
44+
# set to false if you want all page build to be committed to your gh-pages branch history
45+
single-commit: true

.github/workflows/rust.yml

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
on: [push, pull_request]
2+
3+
name: CI
4+
5+
env:
6+
# This is required to enable the web_sys clipboard API which egui_web uses
7+
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
8+
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
9+
RUSTFLAGS: --cfg=web_sys_unstable_apis
10+
11+
jobs:
12+
check:
13+
name: Check
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions-rs/toolchain@v1
18+
with:
19+
profile: minimal
20+
toolchain: stable
21+
override: true
22+
- uses: actions-rs/cargo@v1
23+
with:
24+
command: check
25+
args: --all-features
26+
27+
check_wasm:
28+
name: Check wasm32
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
- uses: actions-rs/toolchain@v1
33+
with:
34+
profile: minimal
35+
toolchain: stable
36+
target: wasm32-unknown-unknown
37+
override: true
38+
- uses: actions-rs/cargo@v1
39+
with:
40+
command: check
41+
args: --all-features --lib --target wasm32-unknown-unknown
42+
43+
test:
44+
name: Test Suite
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- uses: actions-rs/toolchain@v1
49+
with:
50+
profile: minimal
51+
toolchain: stable
52+
override: true
53+
- run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
54+
- uses: actions-rs/cargo@v1
55+
with:
56+
command: test
57+
args: --lib
58+
59+
fmt:
60+
name: Rustfmt
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v2
64+
- uses: actions-rs/toolchain@v1
65+
with:
66+
profile: minimal
67+
toolchain: stable
68+
override: true
69+
components: rustfmt
70+
- uses: actions-rs/cargo@v1
71+
with:
72+
command: fmt
73+
args: --all -- --check
74+
75+
clippy:
76+
name: Clippy
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v2
80+
- uses: actions-rs/toolchain@v1
81+
with:
82+
profile: minimal
83+
toolchain: stable
84+
override: true
85+
components: clippy
86+
- uses: actions-rs/cargo@v1
87+
with:
88+
command: clippy
89+
args: -- -D warnings
90+
91+
trunk:
92+
name: trunk
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v2
96+
- uses: actions-rs/toolchain@v1
97+
with:
98+
profile: minimal
99+
toolchain: 1.72.0
100+
target: wasm32-unknown-unknown
101+
override: true
102+
- name: Download and install Trunk binary
103+
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
104+
- name: Build
105+
run: ./trunk build

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
/dist

0 commit comments

Comments
 (0)