|
| 1 | +name: Docker Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, develop ] |
| 8 | + workflow_dispatch: # Allow manual triggering |
| 9 | + |
| 10 | +jobs: |
| 11 | + docker-integration-test: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + maya-version: ["2022"] # Start with 2022, add others as needed |
| 16 | + fail-fast: false |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v4 |
| 23 | + with: |
| 24 | + python-version: '3.9' # Compatible with Maya 2022 |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + pip install pytest pytest-cov |
| 30 | + |
| 31 | + - name: Check Docker |
| 32 | + run: | |
| 33 | + docker --version |
| 34 | + docker info |
| 35 | + |
| 36 | + - name: Pull Maya Docker image |
| 37 | + run: | |
| 38 | + echo "Pulling Maya ${{ matrix.maya-version }} Docker image..." |
| 39 | + docker pull mottosso/maya:${{ matrix.maya-version }} |
| 40 | + docker images mottosso/maya |
| 41 | + |
| 42 | + - name: Prepare test environment |
| 43 | + run: | |
| 44 | + # Create necessary directories |
| 45 | + mkdir -p test-results |
| 46 | + |
| 47 | + # Set permissions for Docker volume mounting |
| 48 | + chmod -R 755 . |
| 49 | + |
| 50 | + - name: Run Docker integration tests |
| 51 | + run: | |
| 52 | + docker run --rm \ |
| 53 | + -v ${{ github.workspace }}:/workspace \ |
| 54 | + -w /workspace \ |
| 55 | + -e PYTHONPATH=/workspace \ |
| 56 | + -e MAYA_DISABLE_CIP=1 \ |
| 57 | + -e MAYA_DISABLE_CER=1 \ |
| 58 | + mottosso/maya:${{ matrix.maya-version }} \ |
| 59 | + python -m pytest tests/test_docker_integration.py -v -m docker --tb=short |
| 60 | + |
| 61 | + - name: Test basic Maya functionality |
| 62 | + run: | |
| 63 | + docker run --rm \ |
| 64 | + -v ${{ github.workspace }}:/workspace \ |
| 65 | + -w /workspace \ |
| 66 | + -e PYTHONPATH=/workspace \ |
| 67 | + -e MAYA_DISABLE_CIP=1 \ |
| 68 | + -e MAYA_DISABLE_CER=1 \ |
| 69 | + mottosso/maya:${{ matrix.maya-version }} \ |
| 70 | + mayapy -c " |
| 71 | + import maya.standalone |
| 72 | + maya.standalone.initialize() |
| 73 | + import maya.cmds as cmds |
| 74 | + print('Maya version:', cmds.about(version=True)) |
| 75 | + print('Maya build:', cmds.about(buildDirectory=True)) |
| 76 | + maya.standalone.uninitialize() |
| 77 | + print('SUCCESS: Basic Maya test completed') |
| 78 | + " |
| 79 | + |
| 80 | + - name: Test Maya Umbrella import |
| 81 | + run: | |
| 82 | + docker run --rm \ |
| 83 | + -v ${{ github.workspace }}:/workspace \ |
| 84 | + -w /workspace \ |
| 85 | + -e PYTHONPATH=/workspace \ |
| 86 | + -e MAYA_DISABLE_CIP=1 \ |
| 87 | + -e MAYA_DISABLE_CER=1 \ |
| 88 | + mottosso/maya:${{ matrix.maya-version }} \ |
| 89 | + mayapy -c " |
| 90 | + import sys |
| 91 | + sys.path.insert(0, '/workspace') |
| 92 | + import maya.standalone |
| 93 | + maya.standalone.initialize() |
| 94 | + |
| 95 | + try: |
| 96 | + from maya_umbrella import MayaVirusDefender, MayaVirusScanner |
| 97 | + from maya_umbrella.vaccines import get_all_vaccines |
| 98 | + print('SUCCESS: Maya Umbrella imported successfully') |
| 99 | + print(f'Available vaccines: {len(get_all_vaccines())}') |
| 100 | + except Exception as e: |
| 101 | + print(f'ERROR: {e}') |
| 102 | + import traceback |
| 103 | + traceback.print_exc() |
| 104 | + sys.exit(1) |
| 105 | + finally: |
| 106 | + maya.standalone.uninitialize() |
| 107 | + " |
| 108 | + |
| 109 | + - name: Upload test results |
| 110 | + uses: actions/upload-artifact@v3 |
| 111 | + if: always() |
| 112 | + with: |
| 113 | + name: docker-test-results-maya-${{ matrix.maya-version }} |
| 114 | + path: test-results/ |
| 115 | + retention-days: 7 |
| 116 | + |
| 117 | + docker-integration-test-extended: |
| 118 | + runs-on: ubuntu-latest |
| 119 | + if: github.event_name == 'workflow_dispatch' # Only run on manual trigger |
| 120 | + strategy: |
| 121 | + matrix: |
| 122 | + maya-version: ["2023", "2024"] |
| 123 | + fail-fast: false |
| 124 | + |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@v4 |
| 127 | + |
| 128 | + - name: Set up Python |
| 129 | + uses: actions/setup-python@v4 |
| 130 | + with: |
| 131 | + python-version: '3.9' |
| 132 | + |
| 133 | + - name: Install dependencies |
| 134 | + run: | |
| 135 | + python -m pip install --upgrade pip |
| 136 | + pip install pytest pytest-cov |
| 137 | + |
| 138 | + - name: Pull Maya Docker image |
| 139 | + run: | |
| 140 | + echo "Pulling Maya ${{ matrix.maya-version }} Docker image..." |
| 141 | + docker pull mottosso/maya:${{ matrix.maya-version }} || echo "Image not available" |
| 142 | + |
| 143 | + - name: Run extended tests (if image available) |
| 144 | + run: | |
| 145 | + if docker images -q mottosso/maya:${{ matrix.maya-version }} | grep -q .; then |
| 146 | + echo "Running tests with Maya ${{ matrix.maya-version }}" |
| 147 | + docker run --rm \ |
| 148 | + -v ${{ github.workspace }}:/workspace \ |
| 149 | + -w /workspace \ |
| 150 | + -e PYTHONPATH=/workspace \ |
| 151 | + -e MAYA_DISABLE_CIP=1 \ |
| 152 | + -e MAYA_DISABLE_CER=1 \ |
| 153 | + mottosso/maya:${{ matrix.maya-version }} \ |
| 154 | + python -m pytest tests/test_docker_integration.py -v -m docker --tb=short |
| 155 | + else |
| 156 | + echo "Maya ${{ matrix.maya-version }} image not available, skipping" |
| 157 | + fi |
0 commit comments