-
Notifications
You must be signed in to change notification settings - Fork 43
131 lines (110 loc) · 4.45 KB
/
publish_dev.yml
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
name: Test and Publish Dev Release
on:
push:
branches: ["*.dev*"]
paths:
- 'pkgs/community/**'
- 'pkgs/core/**'
- 'pkgs/experimental/**'
- 'pkgs/partners/**'
- 'pkgs/swarmauri/**'
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.packages.outputs.packages }}
steps:
- uses: actions/checkout@v4
- name: Detect Changed Packages
id: packages
run: |
git fetch origin ${{ github.event.before }}
git diff --name-only ${{ github.event.before }} ${{ github.sha }} > changed_files.txt
CHANGED_PACKAGES=$(cat changed_files.txt | grep -oE '^pkgs/(community|core|experimental|partners|swarmauri)' | cut -d/ -f2 | sort -u | tr '\n' ',' | sed 's/,$//')
if [ -z "$CHANGED_PACKAGES" ]; then
# If no packages changed, set to an empty array
CHANGED_PACKAGES_ARRAY="[]"
else
# Convert the comma-separated packages to a JSON array format
CHANGED_PACKAGES_ARRAY=$(echo "[\"$(echo $CHANGED_PACKAGES | sed 's/,/","/g')\"]")
fi
# Export it to GITHUB_OUTPUT in JSON format
echo "packages=$CHANGED_PACKAGES_ARRAY"
echo "packages=$CHANGED_PACKAGES_ARRAY" >> $GITHUB_OUTPUT
test:
needs: detect-changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
package: ${{ fromJSON(needs.detect-changes.outputs.packages) }}
env:
# Model Provider Keys
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
AI21STUDIO_API_KEY: ${{ secrets.AI21STUDIO_API_KEY }}
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
SHUTTLEAI_API_KEY: ${{ secrets.SHUTTLEAI_API_KEY }}
DEEPINFRA_API_KEY: ${{ secrets.DEEPINFRA_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
# Database Keys
QDRANT_URL_KEY: ${{ secrets.QDRANT_URL_KEY }}
QDRANT_API_KEY: ${{ secrets.QDRANT_API_KEY }}
QDRANT_COLLECTION_NAME: ${{ secrets.QDRANT_COLLECTION_NAME }}
# Tools
GITHUBTOOL_TEST_REPO_NAME: ${{ secrets.GITHUBTOOL_TEST_REPO_NAME }}
GITHUBTOOL_TEST_REPO_OWNER: ${{ secrets.GITHUBTOOL_TEST_REPO_OWNER }}
GITHUBTOOL_TEST_TOKEN: ${{ secrets.GITHUBTOOL_TEST_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install flake8 pytest
python -m pip install textblob
python -m textblob.download_corpora
if [ -f pkgs/${{ matrix.package }}/requirements.txt ]; then pip install -r pkgs/${{ matrix.package }}/requirements.txt; fi
- name: Lint with flake8
run: |
flake8 pkgs/${{ matrix.package }} --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 pkgs/${{ matrix.package }} --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build package
run: |
cd pkgs/${{ matrix.package }}
python -m pip install build
python -m build
- name: Install package
run: |
LATEST_WHL=$(ls pkgs/${{ matrix.package }}/dist/*.whl | sort -V | tail -n 1)
python -m pip install "$LATEST_WHL"[full]
- name: Get pip freeze
run: |
pip freeze
- name: Run tests
continue-on-error: true
run: |
pytest -v pkgs/${{ matrix.package }}/tests --junitxml=results.xml
- name: Output test results for debugging
run: |
cat results.xml
- name: Classify test results
run: |
python scripts/classify_results.py results.xml
continue-on-error: false
- name: Publish to PyPI
if: success()
uses: pypa/[email protected]
with:
user: cobycloud
password: ${{ secrets.DANGER_MASTER_PYPI_API_TOKEN }}
packages_dir: pkgs/${{ matrix.package }}/dist