-
Notifications
You must be signed in to change notification settings - Fork 2
234 lines (196 loc) · 7.3 KB
/
github_metrics.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
name: Collect Haystack metrics
on:
workflow_dispatch:
schedule:
# Run twice a day, at midnight and noon
- cron: "0 0,12 * * *"
push:
branches: [main]
paths: [".github/workflows/github_metrics.yml"]
jobs:
github-metrics:
runs-on: ubuntu-latest
strategy:
matrix:
repo:
- deepset-ai/haystack
- deepset-ai/haystack-core-integrations
- deepset-ai/hayhooks
env:
GITHUB_TOKEN: ${{ secrets.HAYSTACK_BOT_TOKEN }}
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Hatch
run: pip install hatch
- name: Get Github stars
working-directory: collector
run: hatch run collector github --repo-name ${{ matrix.repo }} stars
- name: Get Github clones
working-directory: collector
run: hatch run collector github --repo-name ${{ matrix.repo }} clones
- name: Get Github views
working-directory: collector
run: hatch run collector github --repo-name ${{ matrix.repo }} views
- name: Get Github referrers
working-directory: collector
run: hatch run collector github --repo-name ${{ matrix.repo }} referrers
- name: Get Github forks
working-directory: collector
run: hatch run collector github --repo-name ${{ matrix.repo }} forks
- name: Get Github contributors
working-directory: collector
run: hatch run collector github --repo-name ${{ matrix.repo }} contributors
- name: Get Github open issues
working-directory: collector
run: hatch run collector github --repo-name ${{ matrix.repo }} open-issues
- name: Get Github discussions
working-directory: collector
run: hatch run collector github --repo-name ${{ matrix.repo }} discussions
- name: Get Github discussions
working-directory: collector
run: hatch run collector github --repo-name ${{ matrix.repo }} size
haystack-pypi-metrics:
runs-on: ubuntu-latest
strategy:
matrix:
package:
- haystack-ai
- farm-haystack
- llama-index
- langchain
- hayhooks
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Hatch
run: pip install hatch
- name: Get PyPI downloads
id: pypi-downloads
working-directory: collector
run: |
last_month=$(hatch run collector pypi downloads ${{ matrix.package }} last_month)
last_week=$(hatch run collector pypi downloads ${{ matrix.package }} last_week)
last_day=$(hatch run collector pypi downloads ${{ matrix.package }} last_day)
echo "last_month=$last_month" >> $GITHUB_OUTPUT
echo "last_week=$last_week" >> $GITHUB_OUTPUT
echo "last_day=$last_day" >> $GITHUB_OUTPUT
- name: Send metrics
uses: masci/datadog@v1
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
api-url: https://api.datadoghq.eu
metrics: |
- type: "count"
name: "haystack.pypi.downloads_last_month"
value: ${{ steps.pypi-downloads.outputs.last_month }}
host: ${{ matrix.package }}
tags:
- "project:haystack"
- "type:health"
- type: "count"
name: "haystack.pypi.downloads_last_week"
value: ${{ steps.pypi-downloads.outputs.last_week }}
host: ${{ matrix.package }}
tags:
- "project:haystack"
- "type:health"
- type: "count"
name: "haystack.pypi.downloads_last_day"
value: ${{ steps.pypi-downloads.outputs.last_day }}
host: ${{ matrix.package }}
tags:
- "project:haystack"
- "type:health"
generate-integrations-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.get-packages.outputs.matrix }}
steps:
- name: Get package list from README
id: get-packages
run: |
pypi_regex="https:\/\/pypi\.org\/project\/([\w-]+)"
readme_url="https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/main/README.md"
packages=$(curl -s "$readme_url"| awk '/## Inventory/,0' | grep -Po "$pypi_regex" | awk -F'/' '{print $NF}')
matrix=$(echo "$packages" | jq -R -s -c 'split("\n")[:-1] | {packages: .}')
echo "matrix=$matrix" >> $GITHUB_OUTPUT
integrations-pypi-metrics:
needs: generate-integrations-matrix
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(needs.generate-integrations-matrix.outputs.matrix).packages }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Hatch
run: pip install hatch
- name: Get PyPI downloads
id: pypi-downloads
working-directory: collector
run: |
last_month=$(hatch run collector pypi downloads ${{ matrix.package }} last_month)
last_week=$(hatch run collector pypi downloads ${{ matrix.package }} last_week)
last_day=$(hatch run collector pypi downloads ${{ matrix.package }} last_day)
echo "last_month=$last_month" >> $GITHUB_OUTPUT
echo "last_week=$last_week" >> $GITHUB_OUTPUT
echo "last_day=$last_day" >> $GITHUB_OUTPUT
- name: Send metrics
uses: masci/datadog@v1
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
api-url: https://api.datadoghq.eu
metrics: |
- type: "count"
name: "haystack.pypi.downloads_last_month"
value: ${{ steps.pypi-downloads.outputs.last_month }}
host: ${{ matrix.package }}
tags:
- "project:haystack-core-integrations"
- "type:health"
- type: "count"
name: "haystack.pypi.downloads_last_week"
value: ${{ steps.pypi-downloads.outputs.last_week }}
host: ${{ matrix.package }}
tags:
- "project:haystack-core-integrations"
- "type:health"
- type: "count"
name: "haystack.pypi.downloads_last_day"
value: ${{ steps.pypi-downloads.outputs.last_day }}
host: ${{ matrix.package }}
tags:
- "project:haystack-core-integrations"
- "type:health"
twitter-metrics:
runs-on: ubuntu-latest
strategy:
matrix:
username:
- Haystack_AI
- llama_index
- LangChainAI
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Hatch
run: pip install hatch
- name: Get Twitter follower count
working-directory: collector
run: hatch run collector twitter --username ${{ matrix.username }} followers
docker-metrics:
runs-on: ubuntu-latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Hatch
run: pip install hatch
- name: Get docker pulls
working-directory: collector
run: hatch run collector docker pulls