Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PlayCanvas + Standalone Viewer
Browse files Browse the repository at this point in the history
MarcusLongmuir committed Nov 5, 2024

Verified

This commit was signed with the committer’s verified signature.
matthewnessworthy Matthew Nessworthy
1 parent 9c96286 commit 03bc90a
Showing 407 changed files with 34,390 additions and 7,912 deletions.
1 change: 1 addition & 0 deletions .github/actions/npm-install-build-and-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -47,4 +47,5 @@ runs:
path: |
packages/**/build/*
e2e-tests/build/*
github-pages-publisher/build/*
if-no-files-found: error
37 changes: 37 additions & 0 deletions .github/workflows/pr-close.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: delete preview on PR close

# only trigger on pull request closed events
on:
pull_request:
types: [closed]

permissions:
id-token: write
contents: write
pull-requests: write
checks: write

jobs:
delete_preview:
runs-on: ubuntu-20.04
env:
PR_PATH: pull/${{github.event.number}}
steps:
- name: make empty dir
run: mkdir empty-dir

- name: delete folder
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./empty-dir
destination_dir: ${{ env.PR_PATH }}

- name: Comment on PR
uses: hasura/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "🪓 PR closed, deleted preview at https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/"
36 changes: 36 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -110,6 +110,42 @@ jobs:
name: images
path: e2e-tests/test/__image_snapshots__/

publish-gh-pages:
name: Publish GitHub Pages
needs: [ build ]
runs-on: ubuntu-latest
env:
PR_PATH: pull/${{github.event.number}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
lfs: true
persist-credentials: false

- name: "Retrieve Dependencies and Build Artifacts"
id: retrieve-deps-and-build
uses: ./.github/actions/retrieve-deps-and-build

- name: Set base URL for preview if PR
run: echo "BASE_URL=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.PR_PATH }}/" >> $GITHUB_ENV

- name: Deploy to PR preview
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./github-pages-publisher/build
destination_dir: ${{ env.PR_PATH }}

- name: Add PR Preview comment
uses: hasura/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "A preview of this PR can be seen here:\n\n ✨ ${{ env.BASE_URL }} ✨\n\nChanges may take a few minutes to propagate. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/"

summary:
name: Summary
needs: [build, test, type-check, lint, e2e-test]
6 changes: 6 additions & 0 deletions e2e-tests/src/assets/embedded-viewer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div style="background-color: red;">
<iframe src="http://localhost:28893/?url=ws%3A%2F%2Flocalhost%3A7070%2Fmml-websocket&renderer=threejs&ambientLight=0.25&backgroundColor=rgba(255,128,0,1)" allowtransparency="true" width="500" height="500"></iframe>
<iframe src="http://localhost:28893/?url=ws%3A%2F%2Flocalhost%3A7070%2Fmml-websocket&renderer=playcanvas&ambientLight=0.25&backgroundColor=rgba(255,128,0,1)" allowtransparency="true" width="500" height="500"></iframe>
<iframe src="http://localhost:28893/?url=ws%3A%2F%2Flocalhost%3A7070%2Fmml-websocket&renderer=tags&ambientLight=0.25&backgroundColor=rgba(255,128,0,0.5)" allowtransparency="true" width="500" height="500"></iframe>
<iframe src="http://localhost:28893/?renderer=tags&ambientLight=0.25&backgroundColor=rgba(255,128,0,0.5)" allowtransparency="true" width="500" height="500"></iframe>
</div>
3 changes: 2 additions & 1 deletion e2e-tests/src/click-position-test.html
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@

myPlane.addEventListener("click", (e) => {
toggle = !toggle;
myLabel.setAttribute("content", JSON.stringify(e.detail.position));
const {x, y, z} = e.detail.position;
myLabel.setAttribute("content", JSON.stringify({x: x.toFixed(3),y: y.toFixed(3),z: z.toFixed(3)}));
});
</script>
5 changes: 4 additions & 1 deletion e2e-tests/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Stats } from "node:fs";
import * as QueryString from "node:querystring";

import * as chokidar from "chokidar";
import express, { Request, static as expressStatic } from "express";
@@ -122,8 +123,10 @@ app.get("/:documentPath/reset", (req, res) => {
return;
}

const queryString = QueryString.encode(req.query as QueryString.ParsedUrlQueryInput);

currentDocument.reload();
res.redirect("/" + documentPath);
res.redirect("/" + documentPath + "?" + queryString);
});

console.log("Serving on port:", port);
1 change: 1 addition & 0 deletions e2e-tests/src/m-frame-bounds-load-range-test.html
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
unload-range="2"
y="1"
src="/assets/static-mml.html"
debug="true"
></m-frame>

<m-label width="1.5" content="into range" id="set-into-range-label" color="red" x="-2" z="5" y="6.5"></m-label>
2 changes: 1 addition & 1 deletion e2e-tests/src/m-interaction-test.html
Original file line number Diff line number Diff line change
@@ -41,6 +41,6 @@
let interactionToggle = false;
myInteraction.addEventListener("interact", () => {
interactionToggle = !interactionToggle;
myPlane.setAttribute("color", interactionToggle ? "orange" : originalColor);
myPlane.setAttribute("color", interactionToggle ? "blue" : originalColor);
});
</script>
2 changes: 1 addition & 1 deletion e2e-tests/src/m-model-socket-test.html
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
anim="/assets/idle.glb" src="/assets/Body.glb"
anim-start-time="-2000" anim-pause-time="0"
>
<m-cube id="socketed-cube" x="0" socket="head" sx="0.25" sy="0.25" sz="0.25"></m-cube>
<m-cube id="socketed-cube" x="0" color="purple" socket="head" sx="0.25" sy="0.25" sz="0.25"></m-cube>
</m-character>

<script>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 03bc90a

Please sign in to comment.