Skip to content

Commit

Permalink
Refactored CI/CD pipeline and updated server shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
fire committed Jul 22, 2024
1 parent 879aee0 commit 37bbe16
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 19 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,21 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache Blender
id: cache-blender
uses: actions/cache@v2
with:
path: blender.zip
key: ${{ runner.os }}-blender-${{ hashFiles('**/lockfiles') }}

- name: Download and extract Blender
if: steps.cache-blender.outputs.cache-hit != 'true'
shell: powershell
run: |
Invoke-WebRequest -Uri "https://mirrors.ocf.berkeley.edu/blender/release/Blender3.3/blender-3.3.19-windows-x64.zip" -OutFile "blender.zip"
Expand-Archive -Path "blender.zip" -DestinationPath .
- name: Run tests
shell: bash
shell: pwsh
run: |
mkdir -p $MIXER_TEST_OUTPUT
$MIXER_PYTHON_3_PATH -m pip install unittest-xml-reporting parameterized unittest2 xmlrunner
$MIXER_BLENDER_EXE_PATH --background --python-exit-code 1 --python gitlab/install_mixer.py
if [ -f mixer/blender_data/tests/ci.py ]; then
exit 0
fi
$MIXER_BLENDER_EXE_PATH --background --python-exit-code 1 --python mixer/blender_data/tests/ci.py
$MIXER_PYTHON_3_PATH -m xmlrunner discover --verbose tests.vrtist -o $MIXER_TEST_OUTPUT
$MIXER_PYTHON_3_PATH -m xmlrunner discover --verbose tests.broadcaster -o $MIXER_TEST_OUTPUT
$MIXER_PYTHON_3_PATH -m xmlrunner discover --verbose tests.blender -o $MIXER_TEST_OUTPUT
./cicd_test.ps1
16 changes: 16 additions & 0 deletions cicd_test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Set the path to the blender directory
$BLENDER_DIR = "blender-3.3.19-windows-x64"

# Install required python packages
& "$BLENDER_DIR/3.3/python/bin/python.exe" -m pip install unittest-xml-reporting parameterized unittest2 xmlrunner pytest pytest-timeout

# Run the installation script
& "$BLENDER_DIR/blender.exe" --background --python-exit-code 1 --python gitlab/install_mixer.py

# Run the test script
& "$BLENDER_DIR/blender.exe" --background --python-exit-code 1 --python mixer/blender_data/tests/ci.py

# Run the tests and generate XML reports
# & "$BLENDER_DIR/3.3/python/bin/python.exe" -m xmlrunner discover --verbose tests.vrtist -o logs/tests
& "$BLENDER_DIR/3.3/python/bin/python.exe" -m xmlrunner discover --verbose tests.broadcaster -o logs/tests
# & "$BLENDER_DIR/3.3/python/bin/python.exe" -m xmlrunner discover --verbose tests.blender -o logs/tests
6 changes: 0 additions & 6 deletions development.md

This file was deleted.

2 changes: 1 addition & 1 deletion mixer/blender_data/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def write_attribute(
# f"Attempt to write to non-existent attribute {bl_instance}.{key} : skipped"
return

if not prop.is_readonly:
if not prop.is_readonly and not (isinstance(parent, bpy.types.Collection) and key == 'name'):
try:
setattr(parent, key, value)
except TypeError as e:
Expand Down
11 changes: 11 additions & 0 deletions mixer/broadcaster/apps/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,17 @@ def run(self, port):
sock.close()


def shutdown(self):
global SHUTDOWN
SHUTDOWN = True

with self._mutex:
for connection in list(self._connections.values()):
self.handle_client_disconnect(connection)

logger.info("Server has been shut down")


def main():
global _log_server_updates
args, args_parser = parse_cli_args()
Expand Down
2 changes: 1 addition & 1 deletion tests/broadcaster/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,4 @@ def test_client_is_disconnected_when_server_process_is_killed(self):


if __name__ == "__main__":
unittest.main()
unittest.main()

0 comments on commit 37bbe16

Please sign in to comment.