|
| 1 | +name: Build Executables |
| 2 | + |
| 3 | +on: |
| 4 | + |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + debug_enabled: |
| 8 | + type: boolean |
| 9 | + description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' |
| 10 | + required: false |
| 11 | + default: false |
| 12 | + |
| 13 | + push: |
| 14 | + branches: [master] |
| 15 | + pull_request: |
| 16 | + branches: [master] |
| 17 | + |
| 18 | +jobs: |
| 19 | + build-windows: |
| 20 | + runs-on: windows-latest |
| 21 | + steps: |
| 22 | + - name: Setup tmate session |
| 23 | + uses: mxschmitt/action-tmate@v3 |
| 24 | + with: |
| 25 | + detached: true |
| 26 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} |
| 27 | + - uses: conda-incubator/setup-miniconda@v3 |
| 28 | + with: |
| 29 | + auto-update-conda: true |
| 30 | + activate-environment: kivy20 |
| 31 | + python-version: "3.10" |
| 32 | + channels: conda-forge |
| 33 | + - name: Checkout code |
| 34 | + uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + submodules: recursive # Initializes and updates submodules |
| 37 | + - name: create env |
| 38 | + shell: bash -l {0} |
| 39 | + run: conda install -y kivy=2.3 pyinstaller=4.10 requests glfw |
| 40 | + - name: pip installs |
| 41 | + shell: bash -l {0} |
| 42 | + run: pip install kivy-deps.sdl2 kivy-deps.glew pyo |
| 43 | + - name: install smile |
| 44 | + shell: bash -l {0} |
| 45 | + run: pip install -e smile |
| 46 | + - name: create files |
| 47 | + shell: bash -l {0} |
| 48 | + run: echo $SI > serverinfo.txt && echo $ULCRT > cert.pem |
| 49 | + - name: package cogmood |
| 50 | + shell: bash -l {0} |
| 51 | + run: | |
| 52 | + cd package |
| 53 | + export KIVY_GL_BACKEND=angle_sdl2 |
| 54 | + python -m PyInstaller cogmood_windows.spec |
| 55 | + - name: save exe |
| 56 | + uses: actions/upload-artifact@v3 |
| 57 | + with: |
| 58 | + name: SUPREME |
| 59 | + path: package/dist/SUPREME.exe |
| 60 | + |
| 61 | + |
| 62 | + build-macos: |
| 63 | + runs-on: macos-14 |
| 64 | + steps: |
| 65 | + - name: Setup tmate session |
| 66 | + uses: mxschmitt/action-tmate@v3 |
| 67 | + with: |
| 68 | + detached: true |
| 69 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} |
| 70 | + |
| 71 | + - name: Checkout code |
| 72 | + uses: actions/checkout@v4 |
| 73 | + with: |
| 74 | + submodules: recursive # Initializes and updates submodules |
| 75 | + |
| 76 | + - name: Install Homebrew dependencies |
| 77 | + run: | |
| 78 | + brew update |
| 79 | + brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf |
| 80 | +
|
| 81 | + - name: Set up Python |
| 82 | + uses: actions/setup-python@v5 |
| 83 | + with: |
| 84 | + python-version: "3.10" # Specify your Python version |
| 85 | + |
| 86 | + - name: Check if Python is a fat binary |
| 87 | + run: | |
| 88 | + if lipo -info $(which python3) | grep -q "Architectures in the fat file"; then |
| 89 | + lipo -info $(which python3) |
| 90 | + echo "Python is a fat binary." |
| 91 | + export PATH=/Users/runner/hostedtoolcache/Python/3.10.11/arm64/bin:$PATH |
| 92 | + else |
| 93 | + echo "Python is NOT a fat binary." |
| 94 | + exit 1 # Optional: Exit with error if you require a fat binary |
| 95 | + fi |
| 96 | +
|
| 97 | + - name: Install dependencies |
| 98 | + run: | |
| 99 | + export PATH=/Users/runner/hostedtoolcache/Python/3.10.11/arm64/bin:$PATH |
| 100 | + mkdir python_packages |
| 101 | + python3 -m pip install --upgrade pip |
| 102 | + python3 -m pip install --target $PWD/python_packages --only-binary=:all: --platform macosx_10_13_universal2 -r requirements.txt |
| 103 | + export PYTHONPATH=$PWD/python_packages:$PYTHONPATH |
| 104 | + |
| 105 | + |
| 106 | +
|
| 107 | + - name: Build executable with PyInstaller |
| 108 | + run: | |
| 109 | + export PATH=/Users/runner/hostedtoolcache/Python/3.10.11/arm64/bin:$PATH |
| 110 | + export PYTHONPATH=$PWD/python_packages:$PYTHONPATH |
| 111 | + cd package |
| 112 | + python3 -m PyInstaller --noconfirm cogmood_mac.spec |
| 113 | +
|
| 114 | + - name: Upload macOS executable |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: SUPREME |
| 118 | + path: package/dist/SUPREME |
0 commit comments