Skip to content

Commit 55c992a

Browse files
authored
Merge pull request #26 from DioxusLabs/component-preview
Component preview site
2 parents 254ddad + b5b6ef0 commit 55c992a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+4727
-2587
lines changed

.github/workflows/check.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: check examples
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- /**
9+
- preview/**/*.rs
10+
- preview/**/Cargo.toml
11+
- primitives/**/*.rs
12+
- primitives/**/Cargo.toml
13+
- .github/**
14+
- Cargo.toml
15+
16+
pull_request:
17+
types: [opened, synchronize, reopened, ready_for_review]
18+
branches:
19+
- main
20+
paths:
21+
- /**
22+
- preview/**/*.rs
23+
- preview/**/Cargo.toml
24+
- primitives/**/*.rs
25+
- primitives/**/Cargo.toml
26+
- .github/**
27+
- Cargo.toml
28+
29+
concurrency:
30+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
31+
cancel-in-progress: true
32+
33+
jobs:
34+
check:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: awalsh128/cache-apt-pkgs-action@latest
38+
with:
39+
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
40+
version: 1.0
41+
- uses: actions/checkout@v4
42+
- uses: dtolnay/rust-toolchain@stable
43+
- uses: Swatinem/rust-cache@v2
44+
with:
45+
cache-all-crates: "true"
46+
cache-on-failure: "false"
47+
cache-directories: "target/dx"
48+
- name: Check
49+
run: cargo check --workspace --all-features

.github/workflows/gh-pages.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: github pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build-deploy:
14+
runs-on: ubuntu-latest
15+
env:
16+
CARGO_INCREMENTAL: 1
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: awalsh128/cache-apt-pkgs-action@latest
20+
with:
21+
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
22+
version: 1.0
23+
- name: Install Rust
24+
uses: dtolnay/rust-toolchain@master
25+
with:
26+
toolchain: stable
27+
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
28+
- uses: Swatinem/rust-cache@v2
29+
with:
30+
cache-all-crates: "true"
31+
cache-on-failure: "false"
32+
- uses: cargo-bins/cargo-binstall@main
33+
- name: Install CLI
34+
run: cargo install dioxus-cli --git https://github.com/ealmloff/dioxus --branch fix-bundle
35+
- name: Build
36+
run: cd preview && dx build --platform web --release
37+
- name: Copy output
38+
run: cp -r target/dx/preview/release/web/public docs
39+
- name: Add gh pages 404
40+
run: cp docs/index.html docs/404.html
41+
- name: Deploy 🚀
42+
uses: JamesIves/[email protected]
43+
with:
44+
branch: gh-pages # The branch the action should deploy to.
45+
folder: docs # The folder the action should deploy.
46+
target-folder: .
47+
clean: true
48+
single-commit: true

.github/workflows/preview.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy PR previews
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
deploy-preview:
15+
runs-on: ubuntu-latest
16+
env:
17+
CARGO_INCREMENTAL: 1
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: awalsh128/cache-apt-pkgs-action@latest
21+
with:
22+
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
23+
version: 1.0
24+
- name: Install Rust
25+
uses: dtolnay/rust-toolchain@master
26+
with:
27+
toolchain: stable
28+
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
29+
- uses: Swatinem/rust-cache@v2
30+
with:
31+
cache-all-crates: "true"
32+
cache-on-failure: "false"
33+
- uses: cargo-bins/cargo-binstall@main
34+
- name: Install CLI
35+
run: cargo install dioxus-cli --git https://github.com/ealmloff/dioxus --branch fix-bundle
36+
- name: Set base path
37+
run: |
38+
echo "[application]
39+
name = \"Dioxus Preview\"
40+
version = \"0.1.0\"
41+
42+
[web.app]
43+
base_path = \"components/pr-preview/pr-${{ github.event.pull_request.number }}/\"" > preview/Dioxus.toml
44+
- name: Build
45+
run: cd preview && dx build --platform web --release
46+
- name: Copy output
47+
run: cp -r target/dx/preview/release/web/public docs
48+
- name: Add gh pages 404
49+
run: cp docs/index.html docs/404.html
50+
- name: Deploy preview
51+
uses: rossjrw/pr-preview-action@v1
52+
with:
53+
preview-branch: gh-pages # The branch the action should deploy to.
54+
source-dir: docs # The folder the action should deploy.

0 commit comments

Comments
 (0)