-
Notifications
You must be signed in to change notification settings - Fork 322
244 lines (218 loc) · 7.25 KB
/
release.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: llm-app - build and public package
on:
push:
tags:
- 'v*.*.*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
Build_package:
name: Build package
strategy:
fail-fast: false
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Git checkout
uses: actions/checkout@v4
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Build package
run: poetry build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: llm-app
path: ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: CHANGELOG.md
path: CHANGELOG.md
Verify_package:
needs:
- Build_package
name: Verify package
strategy:
matrix:
python-version: ["3.10", "3.11"]
fail-fast: false
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Git checkout
uses: actions/checkout@v4
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: create dir for wheels
run: |
mkdir wheels
- uses: actions/download-artifact@v4
with:
name: llm-app
path: ./wheels/
- name: Build ENV
run: |
cat <<EOF > .env
APP_VARIANT=contextful
PATHWAY_REST_CONNECTOR_HOST=0.0.0.0
PATHWAY_REST_CONNECTOR_PORT=8080
OPENAI_API_KEY=${{ secrets.OPENAI_TOKEN }}
PATHWAY_CACHE_DIR=/tmp/cache
EOF
- name: Install and verify ${{ matrix.os }} package
run: |
set -ex
ENV_NAME="testenv_llm_app"
rm -rf $ENV_NAME
python -m venv ${ENV_NAME}
source ${ENV_NAME}/bin/activate
pip install python-dotenv
pip install --prefer-binary wheels/*.whl
python ./run_examples.py contextful > /dev/null 2>&1 &
sleep 60
curl -s --data '{"user": "user", "query": "How to connect to Kafka in Pathway?"}' http://localhost:8080/
Test_pypi: # test.pypi.org first
needs:
- Build_package
- Verify_package
name: Test pypi
strategy:
fail-fast: false
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: create dir for wheels
run: |
mkdir wheels
- uses: actions/download-artifact@v4
with:
name: llm-app
path: ./wheels/
- uses: actions/download-artifact@v4
with:
name: CHANGELOG.md
path: .
- name: Build ENV
run: |
cat <<EOF > .env
APP_VARIANT=contextful
PATHWAY_REST_CONNECTOR_HOST=0.0.0.0
PATHWAY_REST_CONNECTOR_PORT=8080
OPENAI_API_KEY=${{ secrets.OPENAI_TOKEN }}
PATHWAY_CACHE_DIR=/tmp/cache
EOF
# https://github.com/marketplace/actions/pypi-publish
# https://test.pypi.org/project/llm-app/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
packages-dir: './wheels/'
repository-url: https://test.pypi.org/legacy/
- name: Install and verify ${{ matrix.os }} package
run: |
set -ex
ENV_NAME="testenv_llm_app"
rm -rf $ENV_NAME
python -m venv ${ENV_NAME}
source ${ENV_NAME}/bin/activate
pip install python-dotenv
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple llm-app
pip show llm-app
python ./run_examples.py contextful > /dev/null 2>&1 &
sleep 60
curl -s --data '{"user": "user", "query": "How to connect to Kafka in Pathway?"}' http://localhost:8080/
Publish:
needs:
- Build_package
- Verify_package
- Test_pypi
environment: PROD
name: Publish package
strategy:
# When true GitHub will cancel all in-progress and queued jobs in the matrix if any job in the matrix fails.
fail-fast: false
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
# Add wheelhouse
- name: create dir for wheels
run: |
mkdir wheels
- uses: actions/download-artifact@v4
with:
name: llm-app
path: ./wheels/
- uses: actions/download-artifact@v4
with:
name: CHANGELOG.md
path: .
- name: Save package to S3
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.ARTIFACT_AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.ARTIFACT_AWS_SECRET_ACCESS_KEY }}
dest: ${{ secrets.ARTIFACT_AWS_BUCKET }}
source: ./wheels/*.whl
# https://github.com/marketplace/actions/create-release
- name: Create Release
uses: ncipollo/[email protected]
with:
draft: true
artifacts: "./wheels/*.whl"
artifactContentType: "raw"
allowUpdates: true
bodyFile: "CHANGELOG.md"
tag: ${{github.ref_name}}
commit: main
# https://github.com/marketplace/actions/pypi-publish
# https://pypi.org/project/llm-app/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
packages-dir: './wheels/'
post-release-message:
runs-on: ubuntu-latest
needs: Publish
if: success()
steps:
- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
# Slack channel id, channel name, or user id to post message.
# See also: https://api.slack.com/methods/chat.postMessage#channels
# You can pass in multiple channels to post to by providing a comma-delimited list of channel IDs.
channel-id: "{{ secrets.SLACK_DEV_CHANNEL_ID }}"
# For posting a simple plain text message
payload: |
{
"text": ":tada:\n Hey, it's Manul here. I've made a new release llm-app ${{ github.event.release.tag_name }} released: has been published:\n${{ github.event.release.html_url }} \nhttps://pypi.org/project/llm-app/ \n:tada:",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":tada:\n Hey, it's Manul here. I've made a new release llm-app ${{ github.event.release.tag_name }} released: has been published:\n${{ github.event.release.html_url }} \nhttps://pypi.org/project/llm-app/ \n:tada:"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEV_CHANNEL_URL }}