-
Notifications
You must be signed in to change notification settings - Fork 5
98 lines (86 loc) · 3.01 KB
/
build-test-python.yml
File metadata and controls
98 lines (86 loc) · 3.01 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
# This workflow builds the package, installs it, and tests basic functionality
name: Build and Test Python Package
on:
pull_request:
branches: ["main"]
workflow_call:
env:
PYTHON_VERSION: "3.10"
jobs:
build-package:
name: Build Package
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Build package
uses: ./.github/actions/python-package-build
id: build
with:
uv-version: "0.8.22"
python-version: "${{ env.PYTHON_VERSION }}"
- name: Upload package artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: python-package-${{ github.sha }}
path: dist/
retention-days: 1
test-build-package-extras:
name: Test package build ${{ matrix.name}}
runs-on: ubuntu-latest
needs: build-package
permissions:
contents: read
strategy:
matrix:
include:
- name: cli
test-args: "twyn --version"
- name: mcp
test-args: |
cat <<EOF > init_msg.json
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}
EOF
cat init_msg.json | uv run python src/twyn/mcp/main.py | grep -q "capabilities"
steps:
- name: Check out the repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download package artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-package-${{ github.sha }}
path: dist/
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
version: "0.8.22"
- name: Test package
run: |
uv venv --python $PYTHON_VERSION
WHEEL_FILE=$(ls dist/*.whl)
uv pip install "$WHEEL_FILE[${{ matrix.name }}]"
uv run ${{ matrix.test-args }}
test-build-package-no-extras:
name: Test package build no extras
runs-on: ubuntu-latest
needs: build-package
permissions:
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download package artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-package-${{ github.sha }}
path: dist/
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
version: "0.8.22"
- name: Test package
run: |
uv venv --python $PYTHON_VERSION
WHEEL_FILE=$(ls dist/*.whl)
uv pip install "$WHEEL_FILE"
uv run python -c 'import twyn; twyn.check_dependencies()'