Skip to content

Commit

Permalink
Update CI to build with leptos and pages to use trunk.
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel91 committed Feb 5, 2024
1 parent 1c4d229 commit 2f147c9
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 14 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,33 @@ jobs:
- name: 'Build and test'
run: cargo test --workspace

build_playground_linux:
name: Build Playground (Linux)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: cargo-leptos cache
id: cargo-leptos-cache
uses: actions/cache@v3
with:
path: ~/.cargo/bin/cargo-leptos
key: cargo-leptos-${{ runner.os }}

- name: cargo-leptos install
if: steps.cargo-leptos-cache.outputs.cache-hit != 'true'
run: cargo install cargo-leptos

- name: 'Build playground'
working-directory: ./playground
run: cargo leptos build -v

- name: 'Build playground (server side graphviz)'
working-directory: ./playground
run: cargo leptos build --features "server_side_graphviz" -v

build_and_test_windows:
name: Build and Test (Windows)
runs-on: windows-latest
Expand All @@ -139,3 +166,33 @@ jobs:

- name: 'Build and test'
run: cargo test --workspace

build_playground_windows:
name: Build Playground (Windows)
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Prepare symlink configuration
run: git config --global core.symlinks true

- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: cargo-leptos cache
id: cargo-leptos-cache
uses: actions/cache@v3
with:
path: ~/.cargo/bin/cargo-leptos
key: cargo-leptos-${{ runner.os }}

- name: cargo-leptos install
if: steps.cargo-leptos-cache.outputs.cache-hit != 'true'
run: cargo install cargo-leptos

- name: 'Build playground'
working-directory: ./playground
run: cargo leptos build -v

- name: 'Build playground (server side graphviz)'
working-directory: ./playground
run: cargo leptos build --features "server_side_graphviz" -v
18 changes: 4 additions & 14 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ jobs:
toolchain: nightly
targets: wasm32-unknown-unknown

- name: cargo-leptos cache
id: cargo-leptos-cache
uses: actions/cache@v3
with:
path: ~/.cargo/bin/cargo-leptos
key: cargo-leptos-${{ runner.os }}

- name: cargo-leptos install
if: steps.cargo-leptos-cache.outputs.cache-hit != 'true'
run: cargo install cargo-leptos

- name: Setup Pages
uses: actions/configure-pages@v3

Expand All @@ -67,13 +56,14 @@ jobs:
# 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 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#*/}"
working-directory: ./playground
run: ../trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: 'dist'
# Upload playground/dist directory
path: 'playground/dist'

- name: Deploy to GitHub Pages
id: deployment
Expand Down

0 comments on commit 2f147c9

Please sign in to comment.