|
| 1 | +name: Run LemonadeClient Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + # Linux with source installation |
| 17 | + - os: ubuntu-latest |
| 18 | + install-type: 'source' |
| 19 | + test-name: 'Linux Source' |
| 20 | + |
| 21 | + # Windows with source installation |
| 22 | + - os: windows-latest |
| 23 | + install-type: 'source' |
| 24 | + test-name: 'Windows Source' |
| 25 | + |
| 26 | + # Windows with PyInstaller build |
| 27 | + - os: windows-latest |
| 28 | + install-type: 'pyinstaller' |
| 29 | + test-name: 'Windows PyInstaller' |
| 30 | + |
| 31 | + name: ${{ matrix.test-name }} |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Checkout code |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Set up Python 3.10 |
| 38 | + uses: actions/setup-python@v4 |
| 39 | + with: |
| 40 | + python-version: '3.10' |
| 41 | + |
| 42 | + - name: Install base dependencies |
| 43 | + run: | |
| 44 | + python -m pip install --upgrade pip |
| 45 | + pip install httpx |
| 46 | +
|
| 47 | + - name: Install source dependencies (Linux/Windows Source) |
| 48 | + if: matrix.install-type == 'source' |
| 49 | + run: | |
| 50 | + pip install -e . |
| 51 | +
|
| 52 | + - name: Cache Python dependencies (PyInstaller) |
| 53 | + if: matrix.install-type == 'pyinstaller' && runner.os == 'Windows' |
| 54 | + uses: actions/cache@v3 |
| 55 | + with: |
| 56 | + path: ~/.cache/pip |
| 57 | + key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} |
| 58 | + restore-keys: | |
| 59 | + ${{ runner.os }}-pip- |
| 60 | +
|
| 61 | + - name: Install PyInstaller dependencies (Windows PyInstaller) |
| 62 | + if: matrix.install-type == 'pyinstaller' && runner.os == 'Windows' |
| 63 | + run: | |
| 64 | + python -m pip install -e . |
| 65 | + python -m pip install pyinstaller |
| 66 | +
|
| 67 | + - name: Build PyInstaller executable (Windows PyInstaller) |
| 68 | + if: matrix.install-type == 'pyinstaller' && runner.os == 'Windows' |
| 69 | + run: | |
| 70 | + python -m PyInstaller lemonade_arcade.spec |
| 71 | + continue-on-error: true # PyInstaller build might fail but we still want to test the source |
| 72 | + |
| 73 | + - name: Verify PyInstaller build (Windows PyInstaller) |
| 74 | + if: matrix.install-type == 'pyinstaller' && runner.os == 'Windows' |
| 75 | + run: | |
| 76 | + if (-not (Test-Path "dist\LemonadeArcade.exe")) { |
| 77 | + Write-Warning "PyInstaller executable not found, but continuing with tests" |
| 78 | + } else { |
| 79 | + $exe = Get-Item "dist\LemonadeArcade.exe" |
| 80 | + Write-Host "✓ PyInstaller build successful: $($exe.Name) ($([math]::Round($exe.Length / 1MB, 2)) MB)" |
| 81 | + } |
| 82 | + shell: pwsh |
| 83 | + continue-on-error: true |
| 84 | + |
| 85 | + - name: Run unit tests |
| 86 | + run: | |
| 87 | + python test/lemonade_client_unit.py |
0 commit comments