-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (109 loc) · 3.55 KB
/
Copy pathpackage-python-matrix.yml
File metadata and controls
114 lines (109 loc) · 3.55 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: package-python-matrix
on:
pull_request:
paths:
- ".github/workflows/package-python-matrix.yml"
- "pkgs/**"
- "scripts/monorepo_release.py"
- "tests/packages/**"
- "tests/unit/test_monorepo_release.py"
push:
branches:
- master
paths:
- ".github/workflows/package-python-matrix.yml"
- "pkgs/**"
- "scripts/monorepo_release.py"
- "tests/packages/**"
- "tests/unit/test_monorepo_release.py"
workflow_dispatch:
inputs:
package:
description: Package name to test, or all.
required: false
default: all
python-version:
description: Optional single Python version to test.
required: false
default: all
type: choice
options:
- all
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
permissions:
contents: read
concurrency:
group: package-python-matrix-${{ github.ref }}
cancel-in-progress: true
jobs:
discover-package-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
count: ${{ steps.matrix.outputs.count }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Discover split Python packages
uses: cobycloud/actions/actions/monorepo-discover@aca75c25fa57e8c58ea9a333d0a4b5f25d9f8b0f
with:
package-globs: pkgs/*
ecosystem: python
- name: Validate split package metadata
uses: cobycloud/actions/actions/package-metadata@aca75c25fa57e8c58ea9a333d0a4b5f25d9f8b0f
with:
manifest-globs: |
pkgs/*/*/pyproject.toml
require-description: "true"
require-license: "true"
require-readme: "true"
require-url: "false"
report-json: reports/package-metadata.json
report-md: reports/package-metadata.md
- name: Build package x Python matrix
id: matrix
shell: bash
run: |
set -euo pipefail
args=(--package "${{ inputs['package'] || 'all' }}")
if [[ "${{ inputs['python-version'] || 'all' }}" != "all" ]]; then
args+=(--python-version "${{ inputs['python-version'] }}")
fi
python scripts/monorepo_release.py test-matrix "${args[@]}"
isolated-package-tests:
needs: discover-package-matrix
if: ${{ needs.discover-package-matrix.outputs.count != '0' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.discover-package-matrix.outputs.matrix) }}
name: ${{ matrix.package.name }} / Python ${{ matrix.package.python_version }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.package.python_version }}
- name: Install package test toolchain
shell: bash
run: python -m pip install --upgrade pip uv tomli
- name: Build target package wheel
shell: bash
run: |
set -euo pipefail
python -m uv build \
--project "${{ matrix.package.path }}" \
--out-dir "dist/${{ matrix.package.cell_id }}"
- name: Run isolated package tests
shell: bash
run: |
python scripts/monorepo_release.py isolated-test \
--package "${{ matrix.package.name }}" \
--python-version "${{ matrix.package.python_version }}" \
--dist-dir "dist/${{ matrix.package.cell_id }}"