Skip to content

Fix deployment (again!) #20

Fix deployment (again!)

Fix deployment (again!) #20

Workflow file for this run

name: CI/CD
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install pnpm components
run: |
pnpm install
- name: Run pre-commit
uses: pre-commit/[email protected]
- name: Apply code modifications with pre-commit-ci-lite
uses: pre-commit-ci/lite-action@main
if: always()
test:
name: Test ${{ matrix.packages.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
packages:
- name: '@uatp/components'
directory: packages/components
run: |
pnpm build
pnpm test
- name: '@uatp/template'
directory: packages/create-web/template/web
run: |
# Template depends on component library, must build first
pnpm --filter=@uatp/components build
pnpm rust
pnpm python
pnpm build
pnpm test
- name: '@uatp/create-web Rust'
directory: .
run: |
npm exec ./packages/create-web -- --directory /tmp/rust --project-name rust --backend rust
cd /tmp/rust/web
pnpm install
pnpm rust
pnpm build
pnpm test
- name: '@uatp/create-web Python'
directory: .
run: |
npm exec ./packages/create-web -- --directory /tmp/python --project-name python --backend python
cd /tmp/python/web
pnpm install
pnpm python
pnpm build
pnpm test
- name: '@uatp/create-web no-backend'
directory: .
run: |
npm exec ./packages/create-web -- --directory /tmp/none --project-name none --backend none
cd /tmp/none/web
pnpm install
pnpm build
pnpm test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Install wasm-pack
uses: jetli/[email protected]
- name: Generate Cargo.lock file (for @uatp/template test)
if: ${{ matrix.packages.name == '@uatp/template' }}
working-directory: ${{ matrix.packages.directory }}/../rust_backend
run: cargo generate-lockfile
- name: Cache WASM build (for @uatp/template test)
if: ${{ matrix.packages.name == '@uatp/template' }}
uses: actions/cache@v3
with:
path: packages/create-web/template/rust_backend/target
key: rust_backend-${{ hashFiles('**/Cargo.lock') }}
restore-keys: rust_backend
- name: Install dependencies for all packages
run: pnpm install
- name: Test ${{ matrix.packages.name }}
working-directory: ${{ matrix.packages.directory }}
run: ${{ matrix.packages.run }}
deploy:
name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Install wasm-pack
uses: jetli/[email protected]
- name: Cache WASM build
uses: actions/cache@v3
with:
path: packages/create-web/template/rust_backend/target
key: rust_backend-${{ hashFiles('**/Cargo.lock') }}
restore-keys: rust_backend
- name: Build template for publishing
working-directory: packages/create-web/template/web
run: |
pnpm --filter=@uatp/components build
pnpm install
pnpm rust
pnpm python
BASE_PATH=/web-app-template pnpm build
# Unclear why this is necessary
cp -Rv build/assets/ build/_app/immutable/workers/
- name: Publish
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: packages/create-web/template/web/build