|
| 1 | +name: CI macOS ARM |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["github-actions-ci", "master", "146-macos"] |
| 6 | + pull_request: |
| 7 | + branches: ["master"] |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + bypass_cache: |
| 11 | + description: "Bypass all caches for a clean run" |
| 12 | + type: boolean |
| 13 | + default: false |
| 14 | + |
| 15 | +jobs: |
| 16 | + compile: |
| 17 | + runs-on: macos-14 |
| 18 | + timeout-minutes: 90 |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Set up Python |
| 29 | + uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: ${{ matrix.python-version }} |
| 32 | + |
| 33 | + - name: Read CEF version |
| 34 | + id: cef-version |
| 35 | + run: | |
| 36 | + ver=$(python3 -c " |
| 37 | + import re, sys |
| 38 | + h = open('src/version/cef_version_macarm64.h').read() |
| 39 | + m = re.search(r'#define CEF_VERSION \"([^\"]+)\"', h) |
| 40 | + print(m.group(1)) |
| 41 | + ") |
| 42 | + echo "value=$ver" >> $GITHUB_OUTPUT |
| 43 | +
|
| 44 | + - name: Cache CEF binaries |
| 45 | + uses: actions/cache@v4 |
| 46 | + if: ${{ inputs.bypass_cache != true }} |
| 47 | + with: |
| 48 | + path: | |
| 49 | + build/cef_binary_* |
| 50 | + build/cef*_macarm64 |
| 51 | + key: cef-macosarm64-${{ steps.cef-version.outputs.value }} |
| 52 | + |
| 53 | + - name: Install build tools |
| 54 | + run: python tools/requirements.py |
| 55 | + |
| 56 | + - name: Download CEF binaries |
| 57 | + run: python tools/download_cef.py |
| 58 | + |
| 59 | + - name: Update version header from downloaded CEF |
| 60 | + run: | |
| 61 | + cef_dir=$(ls -d build/cef_binary_*_macosarm64 2>/dev/null | head -1) |
| 62 | + cp "$cef_dir/include/cef_version.h" src/version/cef_version_macarm64.h |
| 63 | +
|
| 64 | + - name: Prepare prebuilt CEF |
| 65 | + run: python tools/automate.py --prebuilt-cef |
| 66 | + |
| 67 | + - name: Configure CMake |
| 68 | + run: cmake -S . -B build/_cmake_build -G Ninja -DCMAKE_BUILD_TYPE=Release |
| 69 | + |
| 70 | + - name: Build |
| 71 | + run: cmake --build build/_cmake_build --parallel |
| 72 | + |
| 73 | + - name: Stage build outputs |
| 74 | + run: | |
| 75 | + mkdir -p build/artifacts |
| 76 | + cp build/_cmake_build/cefpython_py*.so build/artifacts/ |
| 77 | + cp build/_cmake_build/subprocess_build/subprocess build/artifacts/ |
| 78 | + cef_dir=$(ls -d build/cef*_macarm64 2>/dev/null | head -1) |
| 79 | + find "$cef_dir/bin" -maxdepth 1 -mindepth 1 \ |
| 80 | + ! -name 'cefclient*' ! -name 'cefsimple*' ! -name 'ceftests*' \ |
| 81 | + -exec cp -r {} build/artifacts/ \; |
| 82 | +
|
| 83 | + - name: Upload build artifacts |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + with: |
| 86 | + name: build-py${{ matrix.python-version }}-macosarm64 |
| 87 | + path: build/artifacts/ |
| 88 | + retention-days: 1 |
| 89 | + |
| 90 | + test: |
| 91 | + needs: compile |
| 92 | + runs-on: macos-14 |
| 93 | + timeout-minutes: 30 |
| 94 | + strategy: |
| 95 | + fail-fast: false |
| 96 | + matrix: |
| 97 | + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
| 98 | + |
| 99 | + steps: |
| 100 | + - name: Checkout |
| 101 | + uses: actions/checkout@v4 |
| 102 | + |
| 103 | + - name: Set up Python |
| 104 | + uses: actions/setup-python@v5 |
| 105 | + with: |
| 106 | + python-version: ${{ matrix.python-version }} |
| 107 | + |
| 108 | + - name: Download build artifacts |
| 109 | + uses: actions/download-artifact@v4 |
| 110 | + with: |
| 111 | + name: build-py${{ matrix.python-version }}-macosarm64 |
| 112 | + path: build/artifacts/ |
| 113 | + |
| 114 | + - name: Set up cefpython3 package for testing |
| 115 | + run: | |
| 116 | + cp -r build/artifacts/. cefpython3/ |
| 117 | + chmod +x cefpython3/subprocess |
| 118 | +
|
| 119 | + - name: Run unit tests |
| 120 | + run: python unittests/_test_runner.py |
| 121 | + env: |
| 122 | + PYTHONPATH: ${{ github.workspace }} |
| 123 | + |
| 124 | + wheel: |
| 125 | + needs: test |
| 126 | + runs-on: macos-14 |
| 127 | + timeout-minutes: 15 |
| 128 | + strategy: |
| 129 | + fail-fast: false |
| 130 | + matrix: |
| 131 | + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
| 132 | + |
| 133 | + steps: |
| 134 | + - name: Checkout |
| 135 | + uses: actions/checkout@v4 |
| 136 | + |
| 137 | + - name: Set up Python |
| 138 | + uses: actions/setup-python@v5 |
| 139 | + with: |
| 140 | + python-version: ${{ matrix.python-version }} |
| 141 | + |
| 142 | + - name: Download build artifacts |
| 143 | + uses: actions/download-artifact@v4 |
| 144 | + with: |
| 145 | + name: build-py${{ matrix.python-version }}-macosarm64 |
| 146 | + path: build/artifacts/ |
| 147 | + |
| 148 | + - name: Set up cefpython3 package |
| 149 | + run: cp -r build/artifacts/. cefpython3/ |
| 150 | + |
| 151 | + - name: Build wheel |
| 152 | + run: python tools/build_distrib.py |
| 153 | + |
| 154 | + - name: Upload wheel artifact |
| 155 | + uses: actions/upload-artifact@v4 |
| 156 | + with: |
| 157 | + name: cefpython3-py${{ matrix.python-version }}-macosarm64 |
| 158 | + path: build/dist/*.whl |
0 commit comments