This repository has been archived by the owner on Aug 4, 2024. It is now read-only.
forked from workadventure/workadventure
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from thecodingmachine/develop
[pull] develop from thecodingmachine:develop
- Loading branch information
Showing
308 changed files
with
22,491 additions
and
5,961 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions | ||
|
||
name: "End to end tests" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
|
||
jobs: | ||
|
||
start-runner: | ||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) | ||
name: Start self-hosted EC2 runner | ||
runs-on: ubuntu-latest | ||
outputs: | ||
label: ${{ steps.start-ec2-runner.outputs.label }} | ||
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | ||
steps: | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
- name: Start EC2 runner | ||
id: start-ec2-runner | ||
uses: machulav/ec2-github-runner@v2 | ||
with: | ||
mode: start | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
ec2-image-id: ami-094dbcc53250a2480 | ||
ec2-instance-type: t3.xlarge | ||
subnet-id: subnet-0ac40025f559df1bc | ||
security-group-id: sg-0e36e96e3b8ed2d64 | ||
#iam-role-name: my-role-name # optional, requires additional permissions | ||
#aws-resource-tags: > # optional, requires additional permissions | ||
# [ | ||
# {"Key": "Name", "Value": "ec2-github-runner"}, | ||
# {"Key": "GitHubRepository", "Value": "${{ github.repository }}"} | ||
# ] | ||
|
||
|
||
end-to-end-tests: | ||
name: "End-to-end testcafe tests" | ||
|
||
needs: start-runner # required to start the main job when the runner is ready | ||
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2.0.0" | ||
|
||
- name: "Setup NodeJS" | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '14.x' | ||
|
||
- name: "Install dependencies" | ||
run: npm install | ||
working-directory: "tests" | ||
|
||
- name: "Setup .env file" | ||
run: cp .env.template .env | ||
|
||
- name: "Edit ownership of file for test cases" | ||
run: sudo chown 1000:1000 -R . | ||
|
||
- name: "Start environment" | ||
run: LIVE_RELOAD=0 docker-compose up -d | ||
|
||
- name: "Wait for environment to build (and downloading testcafe image)" | ||
run: (docker-compose -f docker-compose.testcafe.yml build &) && docker-compose logs -f --tail=0 front | grep -q "Compiled successfully" | ||
|
||
# - name: "temp debug: display logs" | ||
# run: docker-compose logs | ||
# | ||
# - name: "Wait for back start" | ||
# run: docker-compose logs -f back | grep -q "WorkAdventure HTTP API starting on port" | ||
# | ||
# - name: "Wait for pusher start" | ||
# run: docker-compose logs -f pusher | grep -q "WorkAdventure starting on port" | ||
|
||
- name: "Run tests" | ||
run: PROJECT_DIR=$(pwd) docker-compose -f docker-compose.testcafe.yml up --exit-code-from testcafe | ||
|
||
- name: Upload failed tests | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: my-artifact | ||
path: './tests/screenshots/' | ||
|
||
- name: Display state | ||
if: ${{ failure() }} | ||
run: docker-compose ps | ||
|
||
- name: Display logs | ||
if: ${{ failure() }} | ||
run: docker-compose logs | ||
|
||
stop-runner: | ||
name: Stop self-hosted EC2 runner | ||
needs: | ||
- start-runner # required to get output from the start-runner job | ||
- end-to-end-tests # required to wait when the main job is done | ||
runs-on: ubuntu-latest | ||
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs | ||
steps: | ||
- name: Configure AWS credentials | ||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
- name: Stop EC2 runner | ||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) | ||
uses: machulav/ec2-github-runner@v2 | ||
with: | ||
mode: stop | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
label: ${{ needs.start-runner.outputs.label }} | ||
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
// lib/server.ts | ||
import App from "./src/App"; | ||
import grpc from "grpc"; | ||
import {roomManager} from "./src/RoomManager"; | ||
import {IRoomManagerServer, RoomManagerService} from "./src/Messages/generated/messages_grpc_pb"; | ||
import {HTTP_PORT, GRPC_PORT} from "./src/Enum/EnvironmentVariable"; | ||
import { roomManager } from "./src/RoomManager"; | ||
import { IRoomManagerServer, RoomManagerService } from "./src/Messages/generated/messages_grpc_pb"; | ||
import { HTTP_PORT, GRPC_PORT } from "./src/Enum/EnvironmentVariable"; | ||
|
||
App.listen(HTTP_PORT, () => console.log(`WorkAdventure HTTP API starting on port %d!`, HTTP_PORT)) | ||
App.listen(HTTP_PORT, () => console.log(`WorkAdventure HTTP API starting on port %d!`, HTTP_PORT)); | ||
|
||
const server = new grpc.Server(); | ||
server.addService<IRoomManagerServer>(RoomManagerService, roomManager); | ||
|
||
server.bind('0.0.0.0:'+GRPC_PORT, grpc.ServerCredentials.createInsecure()); | ||
server.bind(`0.0.0.0:${GRPC_PORT}`, grpc.ServerCredentials.createInsecure()); | ||
server.start(); | ||
console.log('WorkAdventure HTTP/2 API starting on port %d!', GRPC_PORT); | ||
console.log("WorkAdventure HTTP/2 API starting on port %d!", GRPC_PORT); |
Oops, something went wrong.