pyOCD Release Builds #17
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: pyOCD Release Builds | |
| on: | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| jobs: | |
| build_artifacts: | |
| name: Build for ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest, ubuntu-24.04-arm] | |
| include: | |
| - os: windows-latest | |
| artifact_name: pyocd-windows | |
| - os: ubuntu-latest | |
| artifact_name: pyocd-linux | |
| - os: macos-latest | |
| artifact_name: pyocd-macos | |
| - os: ubuntu-24.04-arm | |
| artifact_name: pyocd-linux-arm64 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get version from Git | |
| shell: bash | |
| run: | | |
| git fetch --tags --force | |
| tag="$(git describe --tags --abbrev=0 2>/dev/null || true)" | |
| if [[ -n "$tag" ]]; then | |
| ahead="$(git rev-list "${tag}..HEAD" --count)" | |
| ver="${tag#v}" | |
| if [[ "${{ github.event_name }}" != "release" ]]; then | |
| ver="${ver}-dev${ahead}" | |
| fi | |
| else | |
| ver="0.0.0-$(git rev-parse --short HEAD)" | |
| fi | |
| echo "VERSION=$ver" >> "$GITHUB_ENV" | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install packages | |
| run: pip install . build twine pyinstaller | |
| - name: Build wheel and source distribution | |
| run: python -m build | |
| - name: Check distribution files | |
| run: twine check dist/* | |
| - name: Setup build environment | |
| run: python get_site-packages.py | |
| - name: Verify environment | |
| run: | | |
| echo "Site packages: ${{ env.SITE_PACKAGES }}" | |
| python -c "import sys; print(sys.version)" | |
| - name: Build with PyInstaller | |
| run: pyinstaller pyocd.spec --log-level=ERROR --clean | |
| - name: Test binary | |
| run: | | |
| ./dist/pyocd/pyocd --version | |
| ./dist/pyocd/pyocd --help | |
| - name: Upload PyInstaller artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }}-${{ env.VERSION }} | |
| path: dist/pyocd/* | |
| retention-days: 7 | |
| - name: Upload distribution artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.os == 'ubuntu-latest' | |
| with: | |
| name: pyocd-distribution-${{ env.VERSION }} | |
| path: | | |
| dist/*.whl | |
| dist/*.tar.gz | |
| retention-days: 7 |