-
Notifications
You must be signed in to change notification settings - Fork 3
137 lines (121 loc) · 4.31 KB
/
checks.yaml
File metadata and controls
137 lines (121 loc) · 4.31 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: checks
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0 # Fetch full history for proper diff
- name: Set up mise
uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3.6.3
with:
cache: true
experimental: true
- name: Run pre-commit
run: |
mise exec -- pre-commit run --from-ref origin/${{ github.base_ref || 'main' }} --to-ref HEAD
ensure-pinned-actions:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Ensure SHA pinned actions
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@70c4af2ed5282c51ba40566d026d6647852ffa3e # v5.0.1
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
os: [ubuntu-latest, windows-latest]
shard: [0, 1]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up mise
uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3.6.3
with:
cache: true
experimental: true
install_args: python@${{ matrix.python-version }}
- name: Install dependencies
run: |
mise exec python@${{ matrix.python-version }} -- make -C py install-dev
- name: Test whether the Python SDK can be installed
run: |
# This is already done by make install-dev, but we're keeping this as a separate step
# to explicitly verify that installation works
mise exec python@${{ matrix.python-version }} -- python -m uv pip install -e ./py[all]
- name: Test whether the Python SDK can be imported
run: |
mise exec python@${{ matrix.python-version }} -- python -c 'import braintrust'
- name: Run nox tests (shard ${{ matrix.shard }}/2)
shell: bash
run: |
mise exec python@${{ matrix.python-version }} -- bash ./py/scripts/nox-matrix.sh ${{ matrix.shard }} 2
adk-py:
uses: ./.github/workflows/adk-py-test.yaml
langchain-py:
uses: ./.github/workflows/langchain-py-test.yaml
upload-wheel:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up mise
uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3.6.3
with:
cache: true
experimental: true
- name: Install build dependencies and build wheel
run: |
mise exec -- make -C py install-build-deps build
- name: Upload wheel as artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: python-wheel
path: py/dist/*.whl
retention-days: 5
checks-passed:
name: checks-passed
needs:
- lint
- ensure-pinned-actions
- build
- adk-py
- langchain-py
- upload-wheel
runs-on: ubuntu-latest
timeout-minutes: 5
if: always()
steps:
- name: Verify all required checks passed
run: |
FAILED=0
check_result() {
local job_name="$1"
local job_result="$2"
if [ "$job_result" != "success" ] && [ "$job_result" != "skipped" ]; then
echo "Job '$job_name' finished with result: $job_result"
FAILED=1
fi
}
check_result "lint" "${{ needs.lint.result }}"
check_result "ensure-pinned-actions" "${{ needs.ensure-pinned-actions.result }}"
check_result "build" "${{ needs.build.result }}"
check_result "adk-py" "${{ needs.adk-py.result }}"
check_result "langchain-py" "${{ needs.langchain-py.result }}"
check_result "upload-wheel" "${{ needs.upload-wheel.result }}"
if [ "$FAILED" -ne 0 ]; then
echo "One or more required checks failed"
exit 1
fi
echo "All required checks passed"