| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| # |
| --- |
| name: Generate constraints |
| on: # yamllint disable-line rule:truthy |
| workflow_call: |
| inputs: |
| runners: |
| description: "The array of labels (in json form) determining runners." |
| required: true |
| type: string |
| platform: |
| description: "Platform for the build - 'linux/amd64' or 'linux/arm64'" |
| required: true |
| type: string |
| python-versions-list-as-string: |
| description: "Stringified array of all Python versions to test - separated by spaces." |
| required: true |
| type: string |
| python-versions: |
| description: "JSON-formatted array of Python versions to generate constraints for" |
| required: true |
| type: string |
| generate-no-providers-constraints: |
| description: "Whether to generate constraints without providers (true/false)" |
| required: true |
| type: string |
| generate-pypi-constraints: |
| description: "Whether to generate PyPI constraints (true/false)" |
| required: true |
| type: string |
| debug-resources: |
| description: "Whether to run in debug mode (true/false)" |
| required: true |
| type: string |
| use-uv: |
| description: "Whether to use uvloop (true/false)" |
| required: true |
| type: string |
| jobs: |
| generate-constraints-matrix: |
| permissions: |
| contents: read |
| timeout-minutes: 70 |
| name: Generate constraints for ${{ matrix.python-version }} on ${{ inputs.platform }} |
| runs-on: ${{ fromJSON(inputs.runners) }} |
| strategy: |
| fail-fast: false |
| max-parallel: 20 |
| matrix: |
| python-version: ${{ fromJson(inputs.python-versions) }} |
| env: |
| DEBUG_RESOURCES: ${{ inputs.debug-resources }} |
| GITHUB_REPOSITORY: ${{ github.repository }} |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| GITHUB_USERNAME: ${{ github.actor }} |
| INCLUDE_SUCCESS_OUTPUTS: "true" |
| PYTHON_VERSION: ${{ matrix.python-version }} |
| VERBOSE: "true" |
| steps: |
| - name: "Cleanup repo" |
| shell: bash |
| run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" |
| - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| with: |
| persist-credentials: false |
| - name: "Install prek" |
| uses: ./.github/actions/install-prek |
| id: prek |
| with: |
| python-version: ${{ matrix.python-version }} |
| platform: ${{ inputs.platform }} |
| save-cache: false |
| - name: "Prepare breeze & CI image: ${{ matrix.python-version }}" |
| uses: ./.github/actions/prepare_breeze_and_image |
| with: |
| platform: ${{ inputs.platform }} |
| python: ${{ matrix.python-version }} |
| use-uv: ${{ inputs.use-uv }} |
| make-mnt-writeable-and-cleanup: true |
| - name: "Source constraints" |
| shell: bash |
| run: > |
| breeze release-management generate-constraints |
| --airflow-constraints-mode constraints-source-providers --answer yes |
| --python "${PYTHON_VERSION}" |
| - name: "No providers constraints" |
| shell: bash |
| timeout-minutes: 25 |
| run: > |
| breeze release-management generate-constraints |
| --airflow-constraints-mode constraints-no-providers --answer yes |
| --python "${PYTHON_VERSION}" |
| if: inputs.generate-no-providers-constraints == 'true' |
| - name: "Prepare updated provider distributions" |
| shell: bash |
| run: > |
| breeze release-management prepare-provider-distributions |
| --include-not-ready-providers --distribution-format wheel |
| if: inputs.generate-pypi-constraints == 'true' |
| - name: "Prepare airflow distributions" |
| shell: bash |
| run: > |
| breeze release-management prepare-airflow-distributions --distribution-format wheel |
| if: inputs.generate-pypi-constraints == 'true' |
| - name: "Prepare task-sdk distribution" |
| shell: bash |
| run: > |
| breeze release-management prepare-task-sdk-distributions --distribution-format wheel |
| if: inputs.generate-pypi-constraints == 'true' |
| - name: "PyPI constraints" |
| shell: bash |
| timeout-minutes: 25 |
| run: | |
| breeze release-management generate-constraints --airflow-constraints-mode constraints \ |
| --answer yes --python "${PYTHON_VERSION}" |
| if: inputs.generate-pypi-constraints == 'true' |
| - name: "Upload constraint artifacts" |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| with: |
| name: constraints-${{ matrix.python-version }} |
| path: ./files/constraints-${{ matrix.python-version }}/constraints-*.txt |
| retention-days: 7 |
| if-no-files-found: error |
| - name: "Dependency upgrade summary" |
| shell: bash |
| env: |
| PYTHON_VERSION: ${{ matrix.python-version }} |
| run: | |
| echo "Summarizing Python $PYTHON_VERSION" |
| cat "files/constraints-${PYTHON_VERSION}"/*.md >> $GITHUB_STEP_SUMMARY || true |
| df -H |