Format symmetric list concatenations in preview #3440
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: build and publish | |
| on: | |
| release: | |
| types: published | |
| pull_request: | |
| push: | |
| branches: main | |
| permissions: {} | |
| env: | |
| PIP_UPLOADED_PRIOR_TO: P2D | |
| PROJECT: https://pypi.org/p/black | |
| jobs: | |
| configure: | |
| name: generate wheels matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| include: ${{ steps.set-matrix.outputs.include }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.15" | |
| allow-prereleases: true | |
| - name: Install dependencies | |
| run: python -m pip install --group cibw | |
| - name: generate matrix | |
| if: | | |
| github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci: build all wheels') | |
| run: | | |
| { | |
| cibuildwheel --print-build-identifiers --platform linux \ | |
| | pyp 'json.dumps({"only": x, "os": "ubuntu-latest"})' \ | |
| && cibuildwheel --print-build-identifiers --platform macos \ | |
| | pyp 'json.dumps({"only": x, "os": "macos-latest"})' \ | |
| && cibuildwheel --print-build-identifiers --platform windows \ | |
| | pyp 'json.dumps({"only": x, "os": "windows-latest"})' \ | |
| && cibuildwheel --print-build-identifiers --platform windows --archs ARM64 \ | |
| | pyp 'json.dumps({"only": x, "os": "windows-11-arm"})' | |
| } | pyp 'json.dumps(list(map(json.loads, lines)))' > /tmp/matrix | |
| env: | |
| CIBW_ARCHS_LINUX: x86_64 | |
| CIBW_ARCHS_MACOS: x86_64 arm64 | |
| CIBW_ARCHS_WINDOWS: AMD64 | |
| - name: generate matrix (PR) | |
| if: | | |
| github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci: build all wheels') | |
| run: | | |
| { | |
| CIBW_BUILD="cp310-*" cibuildwheel --print-build-identifiers --platform linux | pyp 'json.dumps({"only": x, "os": "ubuntu-latest"})' | |
| CIBW_BUILD="cp314-*" cibuildwheel --print-build-identifiers --platform windows | pyp 'json.dumps({"only": x, "os": "windows-latest"})' | |
| } | pyp 'json.dumps(list(map(json.loads, lines)))' > /tmp/matrix | |
| env: | |
| CIBW_ARCHS_LINUX: x86_64 | |
| - id: set-matrix | |
| run: echo "include=$(cat /tmp/matrix)" | tee -a $GITHUB_OUTPUT | |
| mypyc: | |
| name: mypyc wheels ${{ matrix.only }} | |
| needs: configure | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: ${{ fromJson(needs.configure.outputs.include) }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.15" | |
| allow-prereleases: true | |
| - name: Install dependencies | |
| run: python -m pip install --group cibw | |
| - name: Run cibuildwheel | |
| run: cibuildwheel . --only ${{ matrix.only }} | |
| - name: Upload wheels as workflow artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ${{ matrix.only }}-mypyc-wheels | |
| path: wheelhouse/ | |
| hatch: | |
| name: sdist + pure wheel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.15" | |
| allow-prereleases: true | |
| - name: Install dependencies | |
| run: python -m pip install --group hatch | |
| - name: Calculate PIP_UPLOADED_PRIOR_TO | |
| # virtualenv 20.39 uses pip 26.0 - manually calculate this until we bump virtualenv/hatch | |
| id: uploaded_prior_to | |
| run: | |
| echo "date=$(date -u -d "2 days ago" +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT" | |
| - name: Build wheel and source distributions | |
| run: python -m hatch build | |
| env: | |
| PIP_UPLOADED_PRIOR_TO: ${{ steps.uploaded_prior_to.outputs.date }} | |
| - name: Store the distribution packages | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: sdist-and-pure-wheel | |
| path: dist/ | |
| publish-mypyc: | |
| if: github.event_name == 'release' | |
| needs: mypyc | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: release | |
| url: ${{ env.PROJECT }} | |
| permissions: | |
| id-token: write # Required for PyPI trusted publishing | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: "*-mypyc-wheels" | |
| path: wheelhouse/ | |
| merge-multiple: true | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 | |
| with: | |
| packages-dir: wheelhouse/ | |
| verbose: true | |
| publish-hatch: | |
| if: github.event_name == 'release' | |
| needs: hatch | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: release | |
| url: ${{ env.PROJECT }} | |
| permissions: | |
| id-token: write # Required for PyPI trusted publishing | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: sdist-and-pure-wheel | |
| path: dist/ | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 | |
| with: | |
| verbose: true |