Repository navigation
134 lines (127 loc) · 5.12 KB
/
Copy pathci.yml
File metadata and controls
134 lines (127 loc) · 5.12 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
name: Continuous Integration
permissions:
contents: read
actions: write
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- "releases/*"
jobs:
detect-standalone-changes:
name: Detect standalone sample changes
runs-on: ubuntu-latest
outputs:
projects: ${{ steps.changes.outputs.projects }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Build standalone project matrix
id: changes
shell: bash
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
if [[ -n "$BASE_SHA" ]] && git cat-file -e "$BASE_SHA^{commit}"; then
changed_files="$(git diff --name-only "$BASE_SHA" "$GITHUB_SHA")"
else
changed_files="$(git ls-files)"
fi
projects_json="$({
for project in \
bedrock_agentcore/strands_agent \
lambda_worker \
openai_agents/mcp_v2
do
if grep -q "^${project}/" <<< "$changed_files"; then
printf '%s\n' "$project"
fi
done
} | jq -Rsc 'split("\n") | map(select(length > 0))')"
echo "projects=$projects_json" >> "$GITHUB_OUTPUT"
standalone-lint-test:
name: Standalone (${{ matrix.project }}, Python ${{ matrix.python }})
needs: detect-standalone-changes
if: needs.detect-standalone-changes.outputs.projects != '[]'
strategy:
fail-fast: false
matrix:
python: ["3.10", "3.14"]
project: ${{ fromJSON(needs.detect-standalone-changes.outputs.projects) }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ matrix.python }}
- run: uv sync --locked --all-groups
working-directory: ${{ matrix.project }}
- run: uv run poe lint
working-directory: ${{ matrix.project }}
- run: uv run poe test
working-directory: ${{ matrix.project }}
# Build and test the project
build-lint-test:
strategy:
fail-fast: true
matrix:
python: ["3.10", "3.14"]
os: [ubuntu-latest, macos-intel, macos-arm, windows-latest]
include:
- os: macos-intel
runsOn: macos-15-intel
- os: macos-arm
runsOn: macos-latest
runs-on: ${{ matrix.runsOn || matrix.os }}
# Normal matrix jobs finish in 7-14 minutes; without an explicit limit a
# hung test run burns GitHub's 6-hour default before failing.
timeout-minutes: 30
steps:
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
- name: Print build information
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}, os: ${{ matrix.os }}, python: ${{ matrix.python }}"
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ matrix.python }}
# protoc is needed whenever uv builds temporalio from a git source
# (e.g. when [tool.uv.sources] pins a branch while a feature is in
# development). Kept on by default so we don't have to add and remove
# this step every time we iterate on a new plugin.
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
with:
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: uv tool install poethepoet
- run: uv sync --group=dsl --group=encryption --group=trio-async
- run: poe lint
- run: mkdir junit-xml
- run: poe test -s --junit-xml=junit-xml/${{ matrix.python }}--${{ matrix.os }}.xml
- run: poe test -s --workflow-environment time-skipping --junit-xml=junit-xml/${{ matrix.python }}--${{ matrix.os }}--time-skipping.xml
# This must remain the last step since it downgrades pydantic
- name: Uninstall pydantic
shell: bash
run: |
echo y | uv run pip uninstall pydantic
echo y | uv run pip uninstall pydantic-core
uv run pip install pydantic==1.10
poe test -s --junit-xml=junit-xml/${{ matrix.python }}--${{ matrix.os }}--pydantic-v1.xml tests/pydantic_converter_v1/workflow_test.py
# On latest, run gevent test
- name: Gevent test
if: ${{ matrix.python == '3.12' }}
run: |
uv sync --group gevent
uv run gevent_async/test/run_combined.py
- name: Upload junit-xml artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
if: always()
with:
name: junit-xml--${{github.run_id}}--${{github.run_attempt}}--${{ matrix.python }}--${{ matrix.os }}
path: junit-xml
retention-days: 14