From 461acc5cc44b306bd8bd1495b12f5e1646e49c23 Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 25 Aug 2024 23:59:48 -0400 Subject: [PATCH 1/4] test action --- .github/workflows/test.yml | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f11519b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,48 @@ +name: Run Tests +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + name: Run Tests + env: + TESTING: true + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '20.5.0' + + - name: Install Node.js Dependencies + run: npm install + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10.10' + + - name: Setup Python Virtual Environment + run: python -m venv python3-virtualenv + + - name: Activate Virtual Environment and Install Dependencies + run: | + source python3-virtualenv/bin/activate + pip install -r requirements.txt + + - name: Run Flask Server in Background + run: | + source python3-virtualenv/bin/activate + python api-server/app.py & + sleep 5 # Ensure server has time to start + + - name: Run Tests + run: npm run test \ No newline at end of file From 20a72c4580d0fa15ca7330379090aec19474ebda Mon Sep 17 00:00:00 2001 From: ericz Date: Mon, 26 Aug 2024 00:01:19 -0400 Subject: [PATCH 2/4] fix --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f11519b..7ad6e48 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: - name: Activate Virtual Environment and Install Dependencies run: | source python3-virtualenv/bin/activate - pip install -r requirements.txt + pip install -r api-server/requirements.txt - name: Run Flask Server in Background run: | From 3673e8a3163cb9fd5f33997ab19ff7f076f1c77d Mon Sep 17 00:00:00 2001 From: ericz Date: Mon, 26 Aug 2024 00:20:42 -0400 Subject: [PATCH 3/4] update --- api-server/app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api-server/app.py b/api-server/app.py index 6e6a88b..7dd7d33 100644 --- a/api-server/app.py +++ b/api-server/app.py @@ -44,4 +44,7 @@ def log_message(level, message, meeting=''): setup_webrtc_sockets(socketio) if __name__ == '__main__': - socketio.run(app, debug=True) \ No newline at end of file + if os.getenv('TESTING', True): + app.run(host='0.0.0.0', port=5000, allow_unsafe_werkzeug=True) + else: + app.run(host='0.0.0.0', port=5000) \ No newline at end of file From b373a3650a5176d3bd0cc6e9a1779ff049e5da95 Mon Sep 17 00:00:00 2001 From: ericz Date: Mon, 26 Aug 2024 00:27:28 -0400 Subject: [PATCH 4/4] hopefully fixed --- api-server/app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api-server/app.py b/api-server/app.py index 7dd7d33..8963b70 100644 --- a/api-server/app.py +++ b/api-server/app.py @@ -44,7 +44,8 @@ def log_message(level, message, meeting=''): setup_webrtc_sockets(socketio) if __name__ == '__main__': + import os if os.getenv('TESTING', True): - app.run(host='0.0.0.0', port=5000, allow_unsafe_werkzeug=True) + socketio.run(app, debug=True, allow_unsafe_werkzeug=True) else: - app.run(host='0.0.0.0', port=5000) \ No newline at end of file + socketio.run(app, debug=True) \ No newline at end of file