Merge branch 'develop' of github.com:thecodingmachine/workadventure into develop

This commit is contained in:
_Bastler 2022-03-08 15:17:37 +01:00
commit 633d56fc67
5 changed files with 205 additions and 67 deletions

View File

@ -6,131 +6,237 @@ on:
release: release:
types: [created] types: [created]
pull_request: pull_request:
types: [ labeled, synchronize ] types: [labeled, synchronize]
# Enables BuildKit
env:
DOCKER_BUILDKIT: 1
jobs: jobs:
build-front: build-front:
if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }} if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup NodeJS
# Create a slugified value of the branch uses: actions/setup-node@v2
- uses: rlespinasse/github-slug-action@3.1.0 with:
node-version: '14'
- name: "Build and push front image"
uses: docker/build-push-action@v1 # messages
- name: Install messages dependencies
run: yarn install
working-directory: messages
- name: Build proto messages
run: yarn run ts-proto && yarn run copy-to-front-ts-proto && yarn run json-copy-to-front
working-directory: messages
# docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with: with:
dockerfile: front/Dockerfile
path: ./
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-front
tags: ${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }} - uses: rlespinasse/github-slug-action@3.1.0
add_git_labels: true
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: thecodingmachine/workadventure-front
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: front/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: thecodingmachine/workadventure-front:${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }}
labels: ${{ steps.meta.outputs.labels }}
build-back: build-back:
if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }} if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Create a slugified value of the branch - name: Setup NodeJS
- uses: rlespinasse/github-slug-action@3.1.0 uses: actions/setup-node@v2
with:
- name: "Build and push back image" node-version: '14'
uses: docker/build-push-action@v1
# messages
- name: Install messages dependencies
run: yarn install
working-directory: messages
- name: Build proto messages
run: yarn run proto && yarn run copy-to-back
working-directory: messages
# docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with: with:
dockerfile: back/Dockerfile
path: ./
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-back
tags: ${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }} - uses: rlespinasse/github-slug-action@3.1.0
add_git_labels: true
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: thecodingmachine/workadventure-back
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: back/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: thecodingmachine/workadventure-back:${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }}
labels: ${{ steps.meta.outputs.labels }}
build-pusher: build-pusher:
if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }} if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Create a slugified value of the branch - name: Setup NodeJS
- uses: rlespinasse/github-slug-action@3.1.0 uses: actions/setup-node@v2
with:
- name: "Build and push back image" node-version: '14'
uses: docker/build-push-action@v1
# messages
- name: Install messages dependencies
run: yarn install
working-directory: messages
- name: Build proto messages
run: yarn run proto && yarn run copy-to-pusher && yarn run json-copy-to-pusher
working-directory: messages
# docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with: with:
dockerfile: pusher/Dockerfile
path: ./
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-pusher
tags: ${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }} - uses: rlespinasse/github-slug-action@3.1.0
add_git_labels: true
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: thecodingmachine/workadventure-pusher
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: pusher/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: thecodingmachine/workadventure-pusher:${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }}
labels: ${{ steps.meta.outputs.labels }}
build-uploader: build-uploader:
if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }} if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Checkout - name: Set up Docker Buildx
uses: actions/checkout@v2 uses: docker/setup-buildx-action@v1
# Create a slugified value of the branch - name: Login to DockerHub
- uses: rlespinasse/github-slug-action@3.1.0 uses: docker/login-action@v1
- name: "Build and push back image"
uses: docker/build-push-action@v1
with: with:
dockerfile: uploader/Dockerfile
path: ./
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-uploader
tags: ${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }} - uses: rlespinasse/github-slug-action@3.1.0
add_git_labels: true
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: thecodingmachine/workadventure-uploader
- name: Build and push
uses: docker/build-push-action@v2
with:
file: uploader/Dockerfile
push: true
tags: thecodingmachine/workadventure-uploader:${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }}
labels: ${{ steps.meta.outputs.labels }}
build-maps: build-maps:
if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }} if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# Create a slugified value of the branch - name: Set up Docker Buildx
- uses: rlespinasse/github-slug-action@3.1.0 uses: docker/setup-buildx-action@v1
- name: "Build and push front image" - name: Login to DockerHub
uses: docker/build-push-action@v1 uses: docker/login-action@v1
with: with:
dockerfile: maps/Dockerfile
path: maps/
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-maps
tags: ${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }} - uses: rlespinasse/github-slug-action@3.1.0
add_git_labels: true
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: thecodingmachine/workadventure-maps
- name: Build and push
uses: docker/build-push-action@v2
with:
context: maps/
file: maps/Dockerfile
push: true
tags: thecodingmachine/workadventure-maps:${{ github.event_name == 'pull_request' && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }}
labels: ${{ steps.meta.outputs.labels }}
deeploy: deeploy:
needs: needs:

View File

@ -23,6 +23,12 @@ jobs:
run: npx playwright install --with-deps run: npx playwright install --with-deps
- name: 'Setup .env file' - name: 'Setup .env file'
run: cp .env.template .env run: cp .env.template .env
- name: Install messages dependencies
run: yarn install
working-directory: messages
- name: Build proto messages
run: yarn run proto-all
working-directory: messages
- name: Build WorkAdventure - name: Build WorkAdventure
run: docker-compose -f docker-compose.yaml -f docker-compose.e2e.yml build --parallel run: docker-compose -f docker-compose.yaml -f docker-compose.e2e.yml build --parallel
- name: Start WorkAdventure - name: Start WorkAdventure

View File

@ -0,0 +1,21 @@
<!-- https://lihautan.com/notes/svelte-lazy-load/ -->
<script>
export let when = false;
export let component;
let loading;
$: if (when) {
load();
}
function load() {
loading = component();
}
</script>
{#if when}
{#await loading then { default: Component }}
<Component />
{/await}
{/if}

View File

@ -12,7 +12,6 @@
import AudioManager from "./AudioManager/AudioManager.svelte"; import AudioManager from "./AudioManager/AudioManager.svelte";
import CameraControls from "./CameraControls.svelte"; import CameraControls from "./CameraControls.svelte";
import EmbedScreensContainer from "./EmbedScreens/EmbedScreensContainer.svelte"; import EmbedScreensContainer from "./EmbedScreens/EmbedScreensContainer.svelte";
import EmoteMenu from "./EmoteMenu/EmoteMenu.svelte";
import HelpCameraSettingsPopup from "./HelpCameraSettings/HelpCameraSettingsPopup.svelte"; import HelpCameraSettingsPopup from "./HelpCameraSettings/HelpCameraSettingsPopup.svelte";
import LayoutActionManager from "./LayoutActionManager/LayoutActionManager.svelte"; import LayoutActionManager from "./LayoutActionManager/LayoutActionManager.svelte";
import Menu from "./Menu/Menu.svelte"; import Menu from "./Menu/Menu.svelte";
@ -38,6 +37,7 @@
import { LayoutMode } from "../WebRtc/LayoutManager"; import { LayoutMode } from "../WebRtc/LayoutManager";
import { actionsMenuStore } from "../Stores/ActionsMenuStore"; import { actionsMenuStore } from "../Stores/ActionsMenuStore";
import ActionsMenu from "./ActionsMenu/ActionsMenu.svelte"; import ActionsMenu from "./ActionsMenu/ActionsMenu.svelte";
import Lazy from "./Lazy.svelte";
let mainLayout: HTMLDivElement; let mainLayout: HTMLDivElement;
@ -116,9 +116,7 @@
<VisitCard visitCardUrl={$requestVisitCardsStore} /> <VisitCard visitCardUrl={$requestVisitCardsStore} />
{/if} {/if}
{#if $emoteMenuStore} <Lazy when={$emoteMenuStore} component={() => import("./EmoteMenu/EmoteMenu.svelte")} />
<EmoteMenu />
{/if}
{#if hasEmbedScreen} {#if hasEmbedScreen}
<EmbedScreensContainer /> <EmbedScreensContainer />

View File

@ -27,6 +27,13 @@ npm run test
## Run on production like environment ## Run on production like environment
Build message types:
```bash
cd messages/
yarn run proto-all
```
Start WorkAdventure with: Start WorkAdventure with:
```bash ```bash