Repository navigation
89 lines (84 loc) · 3.88 KB
/
Copy path_setup.yml
File metadata and controls
89 lines (84 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
name: Build workflow setup
on:
workflow_call:
inputs:
package:
description: Package whose docs/packages/<package>.yaml lists the versions to build.
required: true
type: string
version:
description: Version glob to (re)build; empty builds every version not released yet.
required: false
default: ''
type: string
python-exclude:
description: Space-separated interpreter tag globs (e.g. "cp39 cp315*") never to build.
required: false
default: 'cp39'
type: string
outputs:
versions:
description: JSON list of versions to build; "[]" when there is nothing to build.
value: ${{ jobs.setup.outputs.versions }}
matrix:
description: >-
JSON matrix include entries with version, build interpreter `python`
(such as cp314t), `python-version` (such as 3.14t), and `wheel-tag`.
An abi3 entry also has `abi3-floor`; every entry has `platform`
(`manylinux` or `musllinux`). Derived from the python-versions of each
version to build; "[]" when there is nothing to build. Workflows
that still hard-code their interpreters ignore it.
value: ${{ jobs.setup.outputs.matrix }}
jobs:
setup:
if: github.event_name != 'pull_request' || github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.versions.outputs.versions }}
matrix: ${{ steps.versions.outputs.matrix || '[]' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
sparse-checkout: |
ci_scripts
docs/packages
persist-credentials: false
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: false
- name: Select versions of ${{ inputs.package }} to build
id: versions
env:
PACKAGE: ${{ inputs.package }}
VERSION_GLOB: ${{ inputs.version }}
PYTHON_EXCLUDE: ${{ inputs.python-exclude }}
run: |
args=()
if [ -n "$VERSION_GLOB" ]; then
args+=(--glob "$VERSION_GLOB")
elif [[ "${{ github.head_ref }}" == package/* ]]; then
# A package/<pkg> PR builds only the versions it adds on top of the
# base branch. Versions already merged there but not yet released
# stay pending in the YAML; the commit that links a release must not
# rebuild them.
git fetch --quiet --depth=1 origin "${{ github.base_ref }}"
git show "FETCH_HEAD:docs/packages/$PACKAGE.yaml" > "$RUNNER_TEMP/base.yaml" 2>/dev/null \
|| : > "$RUNNER_TEMP/base.yaml"
args+=(--base-file "$RUNNER_TEMP/base.yaml")
elif [[ "${{ github.event_name }}" == push && -n "${{ github.event.before }}" && "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]]; then
git fetch --quiet --depth=1 origin "${{ github.event.before }}"
git show "${{ github.event.before }}:docs/packages/$PACKAGE.yaml" > "$RUNNER_TEMP/base.yaml" 2>/dev/null \
|| : > "$RUNNER_TEMP/base.yaml"
args+=(--base-file "$RUNNER_TEMP/base.yaml")
fi
versions=$(uv run --quiet ci_scripts/pending_versions.py "${args[@]}" "$PACKAGE")
echo "versions=$versions" >> "$GITHUB_OUTPUT"
echo "Versions to build: $versions"
matrix=$(uv run --quiet ci_scripts/pending_versions.py --python-matrix \
--python-exclude "$PYTHON_EXCLUDE" "${args[@]}" "$PACKAGE" 2> "$RUNNER_TEMP/matrix.log")
sed 's/^/::warning::/' "$RUNNER_TEMP/matrix.log"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
echo "Matrix:"
echo "$matrix" | python3 -m json.tool