| 1 | name: pyOCD Release Builds |
| 2 | |
| 3 | on: |
| 4 | release: |
| 5 | types: |
| 6 | - published |
| 7 | workflow_dispatch: |
| 8 | |
| 9 | jobs: |
| 10 | build_artifacts: |
| 11 | name: Build for ${{ matrix.os }} |
| 12 | runs-on: ${{ matrix.os }} |
| 13 | strategy: |
| 14 | fail-fast: false |
| 15 | matrix: |
| 16 | os: [windows-latest, ubuntu-latest, macos-latest, ubuntu-24.04-arm] |
| 17 | include: |
| 18 | - os: windows-latest |
| 19 | artifact_name: pyocd-windows |
| 20 | - os: ubuntu-latest |
| 21 | artifact_name: pyocd-linux |
| 22 | - os: macos-latest |
| 23 | artifact_name: pyocd-macos |
| 24 | - os: ubuntu-24.04-arm |
| 25 | artifact_name: pyocd-linux-arm64 |
| 26 | |
| 27 | steps: |
| 28 | - name: Checkout repository |
| 29 | uses: actions/checkout@v6 |
| 30 | with: |
| 31 | fetch-depth: 0 |
| 32 | |
| 33 | - name: Setup Python |
| 34 | uses: actions/setup-python@v6 |
| 35 | with: |
| 36 | python-version: '3.11' |
| 37 | cache: 'pip' |
| 38 | |
| 39 | - name: Get version from setuptools_scm |
| 40 | shell: bash |
| 41 | run: | |
| 42 | pip install setuptools-scm |
| 43 | version=$(python -c "import setuptools_scm; print(setuptools_scm.get_version())") |
| 44 | echo "PYOCD_VERSION=$version" >> $GITHUB_ENV |
| 45 | echo "Version: $version" |
| 46 | |
| 47 | - name: Install packages |
| 48 | env: |
| 49 | SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.PYOCD_VERSION }} |
| 50 | run: pip install . build twine pyinstaller |
| 51 | |
| 52 | - name: Build wheel and source distribution |
| 53 | env: |
| 54 | SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.PYOCD_VERSION }} |
| 55 | run: python -m build |
| 56 | |
| 57 | - name: Check distribution files |
| 58 | run: twine check dist/* |
| 59 | |
| 60 | - name: Setup build environment |
| 61 | run: python get_site-packages.py |
| 62 | |
| 63 | - name: Verify environment |
| 64 | run: | |
| 65 | echo "Site packages: ${{ env.SITE_PACKAGES }}" |
| 66 | python -c "import sys; print(sys.version)" |
| 67 | |
| 68 | - name: Build with PyInstaller |
| 69 | run: pyinstaller pyocd.spec --log-level=ERROR --clean |
| 70 | |
| 71 | - name: Test binary |
| 72 | run: | |
| 73 | ./dist/pyocd/pyocd --version |
| 74 | ./dist/pyocd/pyocd --help |
| 75 | |
| 76 | - name: Upload PyInstaller artifacts |
| 77 | uses: actions/upload-artifact@v6 |
| 78 | with: |
| 79 | name: ${{ matrix.artifact_name }}-${{ env.PYOCD_VERSION }} |
| 80 | path: dist/pyocd/* |
| 81 | retention-days: 7 |
| 82 | |
| 83 | - name: Upload distribution artifacts |
| 84 | uses: actions/upload-artifact@v6 |
| 85 | if: matrix.os == 'ubuntu-latest' |
| 86 | with: |
| 87 | name: pyocd-distribution-${{ env.PYOCD_VERSION }} |
| 88 | path: | |
| 89 | dist/*.whl |
| 90 | dist/*.tar.gz |
| 91 | retention-days: 7 |