Build Windows Python Package #32
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
| # Copyright (C) 2025-2025 Pico Technology Ltd. See LICENSE file for terms. | |
| name: Build Windows Python Package | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install . | |
| python -m pip install pytest build | |
| # pip install -r requirements.txt # Install your dependencies | |
| - name: Create SDK directory | |
| shell: pwsh | |
| run: | | |
| New-Item -Path "$env:ProgramFiles\Pico Technology\SDK\lib" -ItemType Directory -Force | |
| - name: Test with pytest | |
| run: | | |
| pytest | |
| - name: Build package | |
| run: | | |
| python -m build --wheel | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: python-package | |
| path: dist/ # Assuming your wheel and source distributions are stored in the 'dist' directory | |
| pypi-publish: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| permissions: | |
| id-token: write | |
| environment: | |
| name: pypi | |
| steps: | |
| - name: Retrieve release distributions | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package | |
| path: dist/ | |
| - name: Publish release distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| verbose: true | |
| packages-dir: dist/ | |
| # repository-url: https://test.pypi.org/legacy/ |