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: "Create Python distributions and upload to PyPI" | |
| on: | |
| release: | |
| types: [ published ] | |
| workflow_dispatch: {} | |
| env: | |
| STAN_BACKEND: "CMDSTANPY" | |
| jobs: | |
| make-wheels: | |
| name: Make ${{ matrix.os }} ${{ matrix.cibw_arch }} wheels | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| - macos-14-large # Intel | |
| - macos-14-xlarge # ARM64 | |
| - ubuntu-24.04 # Intel | |
| - ubuntu-24.04-arm # ARM64 | |
| - windows-latest | |
| cibw_arch: ["native"] | |
| # Build one wheel (ABI = none) using first build spec, then test on all python versions. | |
| cibw_build: ["cp310-* cp311-* cp312-*"] | |
| fail-fast: false | |
| steps: | |
| - name: "Set environment variables (Windows)" | |
| shell: pwsh | |
| if: startsWith(runner.os, 'Windows') | |
| run: | | |
| (Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled | |
| $os_version = (Get-CimInstance Win32_OperatingSystem).version | |
| Echo "OS_VERSION=$os_version" >> $env:GITHUB_ENV | |
| - name: "Checkout repo" | |
| uses: actions/checkout@v5 | |
| - name: "Restore RTools40" | |
| if: startsWith(runner.os, 'Windows') | |
| id: cache-rtools | |
| uses: actions/cache@v4 | |
| with: | |
| path: C:/rtools40 | |
| key: ${{ runner.os }}-${{ env.OS_VERSION }}-rtools-v1 | |
| - name: "Build wheels" | |
| uses: pypa/cibuildwheel@v3.2.1 | |
| with: | |
| package-dir: python | |
| env: | |
| CIBW_ENVIRONMENT: > | |
| STAN_BACKEND="${{ env.STAN_BACKEND }}" | |
| MACOSX_DEPLOYMENT_TARGET="${{ matrix.os == 'macos-14-large' && 10.11 || 11.0 }}" | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 # distributed cmdstan binary is broken with manylinux_2_28 | |
| CIBW_BUILD: ${{ matrix.cibw_build }} | |
| CIBW_SKIP: "*musllinux*" | |
| CIBW_ARCHS: ${{ matrix.cibw_arch }} | |
| CIBW_BUILD_FRONTEND: build | |
| CIBW_TEST_REQUIRES: pytest | |
| CIBW_TEST_COMMAND: pytest --pyargs prophet | |
| - name: "Upload wheel as artifact" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-${{ matrix.os }}-${{ matrix.cibw_arch }}-wheel | |
| path: "./**/*.whl" | |
| make-sdist: | |
| name: Make source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: pipx run build --sdist | |
| working-directory: python | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-source-dist | |
| path: "./**/dist/*.tar.gz" | |
| upload: | |
| name: Upload to PyPI | |
| needs: [make-wheels, make-sdist] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| environment: release | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Copy artifacts to dist/ folder | |
| run: | | |
| find . -name 'artifact-*' -exec unzip '{}' \; | |
| mkdir -p dist/ | |
| find . -name '*.tar.gz' -exec mv '{}' dist/ \; | |
| find . -name '*.whl' -exec mv '{}' dist/ \; | |
| - name: Upload | |
| uses: pypa/gh-action-pypi-publish@v1.13.0 |