-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (96 loc) · 3.64 KB
/
Copy pathcheck.yaml
File metadata and controls
108 lines (96 loc) · 3.64 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
---
name: Check
on:
pull_request:
branches:
- main
workflow_call:
inputs:
packages:
description: 'A JSON string with the packages to check.'
required: false
type: string
jobs:
matrix:
name: Compute test matrix
runs-on: ubuntu-latest
outputs:
include: ${{ steps.compute.outputs.include }}
has_pts: ${{ steps.compute.outputs.has_pts }}
steps:
- id: compute
# pts has far more tests than the other packages, so it's sharded
# separately across 4 runners with pytest-split to cut CI wall time.
run: |
packages='${{ inputs.packages || '["orchestration","pis","pts","croissant"]' }}'
include=$(jq -c '[.[] | select(. != "pts") | {package: .}]' <<< "$packages")
has_pts=$(jq -c 'any(. == "pts")' <<< "$packages")
echo "include=$include" >> "$GITHUB_OUTPUT"
echo "has_pts=$has_pts" >> "$GITHUB_OUTPUT"
test:
needs: matrix
if: needs.matrix.outputs.include != '[]'
name: Test ${{ matrix.package }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.matrix.outputs.include) }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Sync dependencies
working-directory: ${{ matrix.package }}
run: uv sync --locked --all-groups --all-extras
- name: Run tests
working-directory: ${{ matrix.package }}
run: uv run --frozen pytest -rxs
- name: run ty # better to do it here because we have deps installed
working-directory: ${{ matrix.package }}
run: uv run --frozen ty check --output-format=github
test-pts:
needs: matrix
if: needs.matrix.outputs.has_pts == 'true'
name: Test pts (shard ${{ matrix.group }}/4)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Sync dependencies
working-directory: pts
run: uv sync --locked --all-groups --all-extras
- name: Run tests
working-directory: pts
run: uv run --frozen pytest -rxs --splits 4 --group ${{ matrix.group }}
- name: run ty # better to do it here because we have deps installed
if: matrix.group == 1
working-directory: pts
run: uv run --frozen ty check --output-format=github
test-gate:
name: Test pts
# branch protection requires the context "Test pts". Since pts's own
# result now lives in test-pts (separate from the other packages), this
# gate reports it under a name that's stable regardless of shard count -
# and stays green when pts isn't part of this run at all (e.g. a
# single-package release tag for another package).
needs: [matrix, test-pts]
if: always()
runs-on: ubuntu-latest
steps:
- run: |
if [[ "${{ needs.matrix.outputs.has_pts }}" == "true" ]]; then
[[ "${{ needs.test-pts.result }}" == "success" ]] || exit 1
fi
lint:
name: Lint all packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- uses: j178/prek-action@bdca6f102f98e2b4c7029491a53dfd366469e33d # v2.0.4
with:
extra-args: --all-files --skip ty # we run ty during test