forked from freqtrade/technical
-
Notifications
You must be signed in to change notification settings - Fork 0
213 lines (179 loc) · 6.23 KB
/
Copy pathci.yml
File metadata and controls
213 lines (179 loc) · 6.23 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
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
name: Technical CI
on:
push:
branches:
- main
- ci/*
tags:
release:
types: [published]
pull_request:
schedule:
- cron: '0 5 * * 4'
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}"
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
name: Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ "ubuntu-22.04", "ubuntu-24.04", "macos-14", "macos-15", "windows-2022", "windows-2025" ]
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
activate-environment: true
enable-cache: true
python-version: ${{ matrix.python-version }}
cache-dependency-glob: "requirements**.txt"
cache-suffix: "${{ matrix.python-version }}"
- name: Installation - *nix
run: |
uv pip install -r requirements-dev.txt
uv pip install -e .
- name: Tests
run: |
pytest --random-order --cov=technical --cov-config=.coveragerc
- name: Run Ruff
run: |
ruff check --output-format=github .
- name: Run Ruff format check
run: |
ruff format --check
- name: Run Codespell
run: |
codespell
- name: Sort imports (isort)
run: |
isort --check .
- name: Discord notification
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
with:
severity: error
details: Technical CI failed on ${{ matrix.os }}
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
# Notify on discord only once - when CI completes (and after deploy) in case it's successful
notify-complete:
name: Notify Discord on CI completion
needs: [ test ]
runs-on: ubuntu-latest
# Discord notification can't handle schedule events
if: (github.event_name != 'schedule')
steps:
- name: Check user permission
id: check
continue-on-error: true
uses: prince-chrismc/check-actor-permissions-action@d504e74ba31658f4cdf4fcfeb509d4c09736d88e # v3.0.2
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Discord notification
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
if: steps.check.outputs.permitted == 'true' && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
with:
severity: info
details: Technical CI
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
build:
name: Build Python 🐍 distribution 📦
if: always()
needs: [ test ]
runs-on: ubuntu-22.04
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: 3.11
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
activate-environment: true
enable-cache: true
python-version: 3.13
cache-dependency-glob: "requirements**.txt"
cache-suffix: "build-3.13"
- name: Extract branch name
id: extract-branch
run: |
echo "GITHUB_REF='${GITHUB_REF}'"
echo "branch=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
- name: Build distribution
run: |
uv pip install -U build
python -m build --sdist --wheel
- name: Upload artifacts 📦
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: technical
path: |
dist
retention-days: 10
deploy-test-pypi:
name: "Publish Python 🐍 distribution 📦 to TestPyPI"
if: (github.event_name == 'release') && github.repository == 'freqtrade/technical'
needs: [ build ]
runs-on: ubuntu-22.04
environment:
name: pypi-test
url: https://test.pypi.org/p/technical
permissions:
id-token: write # needed for pypi publish action
steps:
- name: Download artifact 📦
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: technical
path: dist
merge-multiple: true
- name: Publish to PyPI (Test)
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
if: (github.event_name == 'release')
with:
repository-url: https://test.pypi.org/legacy/
deploy-pypi:
name: "Publish Python 🐍 distribution 📦 to PyPI"
if: (github.event_name == 'release') && github.repository == 'freqtrade/technical'
needs: [ build ]
runs-on: ubuntu-22.04
environment:
name: pypi
url: https://pypi.org/p/technical
permissions:
id-token: write # needed for pypi publish action
steps:
- name: Download artifact 📦
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: technical
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
- name: Discord notification
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
if: always() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
with:
severity: info
details: Technical CI Deploy
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}