-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Trunk to build and deploy the web app #69
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Github Pages | ||
|
||
# By default, runs if you push to master. keeps your deployed app in sync with master branch. | ||
on: | ||
push: | ||
branches: | ||
- master | ||
# to only run when you do a new github release, comment out above part and uncomment the below trigger. | ||
# on: | ||
# release: | ||
# types: | ||
# - published | ||
|
||
permissions: | ||
contents: write # for committing to gh-pages branch. | ||
|
||
jobs: | ||
build-github-pages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 # repo checkout | ||
- uses: actions-rs/toolchain@v1 # get rust toolchain for wasm | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: wasm32-unknown-unknown | ||
override: true | ||
- name: Rust Cache # cache the rust build artefacts | ||
uses: Swatinem/rust-cache@v1 | ||
- name: Downlaod 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 # build | ||
# "${GITHUB_REPOSITORY#*/}" evaluates into the name of the repository | ||
# using --public-url something will allow trunk to modify all the href paths like from favicon.ico to repo_name/favicon.ico . | ||
# this is necessary for github pages where the site is deployed to username.github.io/repo_name and all files must be requested | ||
# relatively as eframe_template/favicon.ico. if we skip public-url option, the href paths will instead request username.github.io/favicon.ico which | ||
# will obviously return error 404 not found. | ||
run: ./trunk build --release --public-url "${GITHUB_REPOSITORY#*/}" | ||
- name: Deploy | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: dist | ||
# this option will not maintain any history of your previous pages deployment | ||
# set to false if you want all page build to be committed to your gh-pages branch history | ||
single-commit: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,8 +33,8 @@ jobs: | |
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: wasm32-unknown-unknown | ||
override: true | ||
- run: rustup target add wasm32-unknown-unknown | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
|
@@ -66,7 +66,7 @@ jobs: | |
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- run: rustup component add rustfmt | ||
components: rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
|
@@ -82,22 +82,24 @@ jobs: | |
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- run: rustup component add clippy | ||
components: clippy | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings | ||
|
||
wasm_bindgen: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trunk does everything that |
||
name: wasm-bindgen | ||
trunk: | ||
name: trunk | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: 1.61.0 | ||
target: wasm32-unknown-unknown | ||
override: true | ||
- run: rustup target add wasm32-unknown-unknown | ||
- run: ./setup_web.sh | ||
- run: ./wasm_bindgen_check.sh | ||
- name: Downlaod 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 | ||
run: ./trunk build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/target | ||
/dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
[package] | ||
name = "eframe_template" | ||
default-run = "eframe_template_bin" | ||
version = "0.1.0" | ||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] | ||
edition = "2021" | ||
rust-version = "1.60" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[[bin]] | ||
name = "eframe_template_bin" | ||
path = "src/main.rs" | ||
|
||
[lib] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume these options were to allow raw wasm compilation? that's why i removed them as we just use main.rs instead of custom start functions in lib.rs . |
||
crate-type = ["cdylib", "rlib"] | ||
|
||
|
||
[dependencies] | ||
egui = "0.18.0" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
filehash = false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "Egui Template PWA", | ||
"short_name": "egui-template-pwa", | ||
"icons": [ | ||
{ | ||
"src": "./icon-256.png", | ||
"sizes": "256x256", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "./maskable_icon_x512.png", | ||
"sizes": "512x512", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "./icon-1024.png", | ||
"sizes": "1024x1024", | ||
"type": "image/png" | ||
} | ||
], | ||
"lang": "en-US", | ||
"id": "/index.html", | ||
"start_url": "./index.html", | ||
"display": "standalone", | ||
"background_color": "white", | ||
"theme_color": "white" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ self.addEventListener('fetch', function (e) { | |
return response || fetch(e.request); | ||
}) | ||
); | ||
}); | ||
}); |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more straightforward to just use the action's configuration, instead of doing things as an extra manual step