-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (157 loc) · 7.43 KB
/
ci-upgrade.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
---
# SOURCE: https://github.com/openai/openai-python/blob/aed1e43745cd6358b4bafd3a39b3dfeee5e31a03/.github/workflows/ci.yml
name: CI-UPGRADE
# SOURCE: https://github.com/tornadoweb/tornado/blob/f399f40fde0ae1b130646db783a6f79cc59231b2/.github/workflows/build.yml#L37
on: # yamllint disable-line rule:truthy
# https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#push
push:
branches:
# Run on release branches. This gives us a chance to detect rot in this
# configuration before pushing a tag (which we'd rather not have to undo).
- main
- feature/**
- '[0-9].*.x' # e.g., 4.14.x
- '[0-9][0-9].*.x' # e.g., 23.3.x
tags:
# The main purpose of this workflow is to build wheels for release tags.
# It runs automatically on tags matching this pattern and pushes to pypi.
- "v*"
# https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
pull_request:
# https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_dispatch
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
# Allow this workflow to be run manually (pushing to testpypi instead of pypi)
env:
python-version: '3.10'
jobs:
test:
name: test
runs-on: ubuntu-22.04
if: github.repository == 'bossjones/goob_ai'
env:
OS: ubuntu-22.04
PYTHON: '3.10'
LANGCHAIN_ENDPOINT: "https://api.smith.langchain.com"
LANGCHAIN_TRACING_V2: true
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LANGCHAIN_API_KEY: ${{ secrets.LANGCHAIN_API_KEY }}
# Update with your API URL if using a hosted instance of Langsmith.
LANGCHAIN_HUB_API_URL: "https://api.hub.langchain.com"
LANGCHAIN_HUB_API_KEY: ${{ secrets.LANGCHAIN_API_KEY }}
LANGCHAIN_PROJECT: "goob-ci-upgrade"
GOOB_AI_CONFIG_DISCORD_TOKEN: "foo"
GOOB_AI_CONFIG_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref_name }} and your repository is ${{ github.repository }}."
- name: Set up Git repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Start Redis
id: redis-docker-compose-up
run: |
curl -SL https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker compose up -d
docker ps -a
continue-on-error: true
- name: Start Chroma
id: chroma-docker-compose-up
run: |
mkdir -p ./src/goob_ai/data/chroma/vectorstorage || true
# git clone --depth 1 --branch feature-boss-chroma https://github.com/bossjones/chroma.git vendored_chroma
# cd vendored_chroma
docker compose up -d
docker ps -a
continue-on-error: true
- name: Checkout
uses: actions/checkout@v4
- name: get version python
shell: bash # use bash to run date command
run: echo "Py${{ env.python-version }}"
- name: Hash + Timestamp
shell: bash # use bash to run date command
run: 'echo "HASH=${{ runner.os }}-${{ runner.arch }}-Py${{ env.python-version }}-$(date -u "+%Y%m")" >> $GITHUB_ENV'
- name: "Set up Python ${{ env.python-version }}"
uses: actions/setup-python@v5
with:
python-version: "${{ env.python-version }}"
- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: 'latest'
RYE_INSTALL_OPTION: '--yes'
- name: install tesseract
run: |
# wget -qO - 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null
# echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list
sudo apt update
sudo apt-get install -y tesseract-ocr tesseract-ocr-por
# sudo apt-get install -y tesseract-ocr tesseract-ocr-por just zsh
curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-full-linux-x86_64.gz | gzip -d - | sudo install -m 755 /dev/stdin /usr/local/bin/taplo
- name: install tesseract and ffmpeg
run: |
sudo apt-get install -y tesseract-ocr tesseract-ocr-por libyaml-dev poppler-utils
sudo apt install ffmpeg -y
sudo apt-get install autoconf automake build-essential libtool python3-dev libsqlite3-dev -y
# Allow debugging with tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
with:
limit-access-to-actor: true
- name: Run tests and collect coverage
id: upgrade-and-test
continue-on-error: true
env:
LANGCHAIN_ENDPOINT: "https://api.smith.langchain.com"
LANGCHAIN_TRACING_V2: true
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LANGCHAIN_API_KEY: ${{ secrets.LANGCHAIN_API_KEY }}
# Update with your API URL if using a hosted instance of Langsmith.
LANGCHAIN_HUB_API_URL: "https://api.hub.langchain.com"
LANGCHAIN_HUB_API_KEY: ${{ secrets.LANGCHAIN_API_KEY }}
LANGCHAIN_PROJECT: "goob-ci-upgrade"
GOOB_AI_CONFIG_DISCORD_TOKEN: "foo"
GOOB_AI_CONFIG_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
cp -f env.sample .env
rye config --set-bool behavior.use-uv=true
./scripts/retry -t 4 -- rye sync --update-all --all-features
rye run goobctl chroma generate
git diff requirements.lock > requirements.lock.diff
git diff requirements-dev.lock > requirements-dev.lock.diff
# rye run typecheck
echo "rye run python -c 'import goob_ai'"
rye run python -c 'import goob_ai'
pip install pre-commit
pre-commit install
pre-commit autoupdate
# NOTE: just fmt
git ls-files '*.py' '*.ipynb' | xargs rye run pre-commit run --files
# NOTE: just lint
pre-commit run ruff --all-files
echo "rye run test"
rye run test
- name: Upload Diff Of Rye Requirements
if: '!cancelled()'
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: rye-requirements-diff-${{ env.HASH }}
path: |
requirements.lock
requirements.lock.diff
requirements-dev.lock.diff
requirements-dev.lock
pyproject.toml
retention-days: 1 # temporary, combined in aggregate below