ci: add macos testing case #168
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: flux-python | |
| on: | |
| pull_request: {} | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Pypi version' | |
| release_version: | |
| description: 'Version of flux to build' | |
| default: "0.78.0" | |
| rc: | |
| description: 'Release candidate to build (for wheel)' | |
| default: "0" | |
| branch: | |
| description: 'Branch to build from' | |
| default: "master" | |
| repo: | |
| description: 'Repository to build from' | |
| default: "https://github.com/flux-framework/flux-core" | |
| jobs: | |
| build: | |
| name: ${{ matrix.os }} Python ${{ matrix.python }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # The matrix now includes both os and python | |
| os: [ubuntu-latest, macos-latest] | |
| python: ["py38", "py39", "py310", "py311", "py312"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: prefix-dev/setup-pixi@v0.9.0 | |
| with: | |
| environments: ${{ matrix.python }} | |
| - name: Build Flux Core Branch | |
| run: pixi run -e ${{ matrix.python }} bash .github/scripts/setup.sh ${{ matrix.python }} ${{ inputs.release_version }} ${{ inputs.version }} | |
| - name: Upload logs on failure | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: config-log-${{ matrix.python }}-${{ matrix.os }} | |
| path: ./config.log | |
| - name: Build Python Bindings | |
| run: pixi run -e ${{ matrix.python }} bash .github/scripts/build-bindings.sh ${{ inputs.branch }} ${{ inputs.repo }} | |
| - name: Build Python Wheels | |
| run: pixi run -e ${{ matrix.python }} bash ./docker/build-wheels.sh ${{ env.build_number }} ${{ env.python_version }} | |
| - name: Upload distributions | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| # The artifact name must be unique for each job in the matrix | |
| name: dist-${{ matrix.python }}-${{ matrix.os }} | |
| path: ./dist | |
| upload: | |
| runs-on: ubuntu-latest | |
| # This job now needs the entire build matrix to complete successfully | |
| needs: [build] | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| # Download all artifacts created by the build jobs | |
| path: artifacts | |
| - name: Show and Organize Files | |
| run: | | |
| ls -R artifacts | |
| mkdir -p ./dist | |
| # This command finds all wheel and tar.gz files in all subdirectories | |
| # and moves them into a single ./dist directory for upload. | |
| find artifacts -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec mv {} ./dist/ \; | |
| echo | |
| echo "Files to distribute:" | |
| ls ./dist | |
| - name: Build and publish | |
| # Ensure this only runs on pushes to a main branch, not PRs | |
| if: (github.event_name != 'pull_request') | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PYPI_USER }} | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASS }} | |
| run: | | |
| python3 -m pip install --upgrade twine | |
| twine upload --skip-existing dist/* |