-
Notifications
You must be signed in to change notification settings - Fork 601
123 lines (118 loc) · 3.59 KB
/
ci_cd.yml
File metadata and controls
123 lines (118 loc) · 3.59 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
VISION_AGENT_API_KEY: ${{ secrets.VISION_AGENT_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
OPENAI_API_KEY: 123test
PYTHONUTF8: 1
jobs:
unit_test:
name: Test
strategy:
matrix:
python-version: [3.9, 3.11]
os: [ ubuntu-22.04, windows-2022, macos-14 ]
runs-on: ${{ matrix.os }}
env:
RUNTIME_TAG: ci_job
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
shell: bash
run: |
pip install uv
uv --version
- name: Print Python environment information
run: |
uv run which python
uv run python --version
uv run pip --version
- name: Install dependencies
run: |
# Install main dependencies first so we can see their size
uv sync --all-extras
- name: Linting
run: |
# stop the build if there are Python syntax errors or undefined names
uv run flake8 . --exclude .venv,examples,tests --count --show-source --statistics
- name: Check Format
run: |
uv run black --check --diff --color vision_agent/
- name: Type Checking
run: |
uv run mypy vision_agent
- name: Test with pytest
run: |
uv run pytest -s -vvv tests/unit
integ_test:
name: Integration Test
runs-on: ubuntu-22.04
env:
RUNTIME_TAG: ci_job
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install uv
shell: bash
run: |
pip install uv
uv --version
- name: Print Python environment information
run: |
uv run which python
uv run python --version
uv run pip --version
- name: Install dependencies
run: |
# Install main dependencies first so we can see their size
uv sync --all-extras
- name: Test with pytest
run: |
uv run pytest -v tests/integ
release:
name: Release
needs: unit_test
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):') && !contains(github.event.head_commit.message, '[skip release]')
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.10.11
- name: Install uv
shell: bash
run: |
pip install uv
uv --version
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- name: setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "yazhou.cao@landing.ai"
- name: Bump up version
run: |
current_version=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)
IFS='.' read -r major minor patch <<< "$current_version"
patch=$((patch + 1))
new_version="${major}.${minor}.${patch}"
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version "$new_version"
git add pyproject.toml
git commit -m "[skip ci] chore(release): ${new_version}"
git push -f
- name: Publish to PyPI
run: |
uv build
uv publish --token ${{ secrets.PYPI_TOKEN }}