Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Demo

# The demo application, with PHP as WebAssembly, on GitHub Pages: see
# wasm-demo/castor.php. GitHub Pages must deploy from GitHub Actions, in the
# settings of the repository.

on:
push:
branches: [ main ]
workflow_dispatch: ~

permissions:
contents: read
pages: write
id-token: write

# One deployment at a time, the last push wins
concurrency:
group: pages
cancel-in-progress: true

jobs:
deploy:
runs-on: ubuntu-latest
name: "Build and deploy the demo"
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
env:
COMPOSER_ROOT_VERSION: "dev-main"
defaults:
run:
working-directory: wasm-demo
steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "8.5"
tools: 'castor, composer:v2, flex'
coverage: none

- name: "Setup node"
uses: actions/setup-node@v4
with:
node-version: 24

- name: "Install PHP dependencies"
run: composer install --no-interaction --no-scripts
working-directory: .

- name: "Install php-wasm-builder"
run: castor castor:composer install --no-interaction

- name: "Configure GitHub Pages"
id: pages
uses: actions/configure-pages@v5

# The cache of the layers needs the docker-container driver of
# buildx, and the runtime token and URLs of GitHub Actions
- name: "Setup buildx"
uses: docker/setup-buildx-action@v3

- name: "Expose the GitHub Actions runtime"
uses: crazy-max/ghaction-github-runtime@v3

- name: "Build the demo"
run: >
castor demo:build
--base-path='${{ steps.pages.outputs.base_path }}/'
--set='*.cache-from=type=gha'
--set='*.cache-to=type=gha,mode=max,ignore-error=true'

- name: "Check the pages of the admin panel"
run: castor demo:check

# Only demo:check runs PHP in node
- name: "Remove the build for node"
run: rm public/build/php-node.*

- name: "Upload the demo"
uses: actions/upload-pages-artifact@v3
with:
path: wasm-demo/public

- name: "Deploy to GitHub Pages"
id: deployment
uses: actions/deploy-pages@v4
4 changes: 2 additions & 2 deletions config/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
index:
path: /
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
defaults:
template: base.html.twig
route: sylius_admin_ui_dashboard

basic_create:
path: /basic/create
Expand Down
8 changes: 8 additions & 0 deletions wasm-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.castor/vendor/
/build/
/public/build/
/public/assets/
/public/avatars/
/public/bundles/
/public/404.html
/.castor.stub.php
5 changes: 5 additions & 0 deletions wasm-demo/castor.composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"lyrixx/php-wasm-builder": "^1.0"
}
}
64 changes: 64 additions & 0 deletions wasm-demo/castor.composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading