Skip to content

Commit d85e737

Browse files
committed
i swear if it was just my pages toml being broken
1 parent 16cea51 commit d85e737

File tree

1 file changed

+162
-37
lines changed

1 file changed

+162
-37
lines changed

.github/workflows/pages.yml

+162-37
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,173 @@
1-
name: Github Pages
2-
3-
# By default, runs if you push to main. keeps your deployed app in sync with main branch.
4-
on:
5-
push:
6-
branches:
7-
- main
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.
1+
on: [push, pull_request, workflow_dispatch]
2+
3+
name: CI
4+
5+
env:
6+
# --cfg=web_sys_unstable_apis 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: -D warnings --cfg=web_sys_unstable_apis
10+
RUSTDOCFLAGS: -D warnings
1611

1712
jobs:
18-
build-github-pages:
13+
check:
14+
name: Check
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions-rs/toolchain@v1
19+
with:
20+
profile: minimal
21+
toolchain: stable
22+
override: true
23+
- uses: actions-rs/cargo@v1
24+
with:
25+
command: check
26+
args: --all-features
27+
28+
check_wasm:
29+
name: Check wasm32
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: actions-rs/toolchain@v1
34+
with:
35+
profile: minimal
36+
toolchain: stable
37+
target: wasm32-unknown-unknown
38+
override: true
39+
- uses: actions-rs/cargo@v1
40+
with:
41+
command: check
42+
args: --all-features --lib --target wasm32-unknown-unknown
43+
44+
test:
45+
name: Test Suite
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: actions-rs/toolchain@v1
50+
with:
51+
profile: minimal
52+
toolchain: stable
53+
override: true
54+
- run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
55+
- uses: actions-rs/cargo@v1
56+
with:
57+
command: test
58+
args: --lib
59+
60+
fmt:
61+
name: Rustfmt
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v4
65+
- uses: actions-rs/toolchain@v1
66+
with:
67+
profile: minimal
68+
toolchain: stable
69+
override: true
70+
components: rustfmt
71+
- uses: actions-rs/cargo@v1
72+
with:
73+
command: fmt
74+
args: --all -- --check
75+
76+
clippy:
77+
name: Clippy
1978
runs-on: ubuntu-latest
2079
steps:
21-
- uses: actions/checkout@v2 # repo checkout
22-
- uses: actions-rs/toolchain@v1 # get rust toolchain for wasm
80+
- uses: actions/checkout@v4
81+
- uses: actions-rs/toolchain@v1
2382
with:
2483
profile: minimal
2584
toolchain: stable
85+
override: true
86+
components: clippy
87+
- uses: actions-rs/cargo@v1
88+
with:
89+
command: clippy
90+
args: -- -D warnings
91+
92+
trunk:
93+
name: trunk
94+
runs-on: ubuntu-latest
95+
steps:
96+
- uses: actions/checkout@v4
97+
- uses: actions-rs/toolchain@v1
98+
with:
99+
profile: minimal
100+
toolchain: 1.76.0
26101
target: wasm32-unknown-unknown
27102
override: true
28-
- name: Rust Cache # cache the rust build artefacts
29-
uses: Swatinem/rust-cache@v1
30103
- name: Download and install Trunk binary
31104
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-
# Environment $public_url resolves to the github project page.
34-
# If using a user/organization page, remove the `${{ github.event.repository.name }}` part.
35-
# using --public-url something will allow trunk to modify all the href paths like from favicon.ico to repo_name/favicon.ico .
36-
# this is necessary for github pages where the site is deployed to username.github.io/repo_name and all files must be requested
37-
# relatively as eframe_template/favicon.ico. if we skip public-url option, the href paths will instead request username.github.io/favicon.ico which
38-
# will obviously return error 404 not found.
39-
run: ./trunk build --release --public-url $public_url
40-
env:
41-
public_url: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
42-
- name: Deploy
43-
uses: JamesIves/github-pages-deploy-action@v4
44-
with:
45-
folder: dist
46-
# this option will not maintain any history of your previous pages deployment
47-
# set to false if you want all page build to be committed to your gh-pages branch history
48-
single-commit: true
105+
- name: Build
106+
run: ./trunk build
107+
108+
build:
109+
runs-on: ${{ matrix.os }}
110+
strategy:
111+
fail-fast: false
112+
matrix:
113+
include:
114+
- os: macos-latest
115+
TARGET: aarch64-apple-darwin
116+
117+
- os: ubuntu-latest
118+
TARGET: aarch64-unknown-linux-gnu
119+
120+
- os: ubuntu-latest
121+
TARGET: armv7-unknown-linux-gnueabihf
122+
123+
- os: ubuntu-latest
124+
TARGET: x86_64-unknown-linux-gnu
125+
126+
- os: windows-latest
127+
TARGET: x86_64-pc-windows-msvc
128+
EXTENSION: .exe
129+
130+
steps:
131+
- name: Building ${{ matrix.TARGET }}
132+
run: echo "${{ matrix.TARGET }}"
133+
134+
- uses: actions/checkout@master
135+
- name: Install build dependencies - Rustup
136+
run: |
137+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile default --target ${{ matrix.TARGET }} -y
138+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
139+
140+
# For linux, it's necessary to use cross from the git repository to avoid glibc problems
141+
# Ref: https://github.com/cross-rs/cross/issues/1510
142+
- name: Install cross for linux
143+
if: contains(matrix.TARGET, 'linux')
144+
run: |
145+
cargo install cross --git https://github.com/cross-rs/cross --rev 1b8cf50d20180c1a394099e608141480f934b7f7
146+
147+
- name: Install cross for mac and windows
148+
if: ${{ !contains(matrix.TARGET, 'linux') }}
149+
run: |
150+
cargo install cross
151+
152+
- name: Build
153+
run: |
154+
cross build --verbose --release --target=${{ matrix.TARGET }}
155+
156+
- name: Rename
157+
run: cp target/${{ matrix.TARGET }}/release/eframe_template${{ matrix.EXTENSION }} eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
158+
159+
- uses: actions/upload-artifact@master
160+
with:
161+
name: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
162+
path: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
163+
164+
- uses: svenstaro/upload-release-action@v2
165+
name: Upload binaries to release
166+
if: ${{ github.event_name == 'push' }}
167+
with:
168+
repo_token: ${{ secrets.GITHUB_TOKEN }}
169+
file: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
170+
asset_name: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
171+
tag: ${{ github.ref }}
172+
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
173+
overwrite: true

0 commit comments

Comments
 (0)