Skip to content

Commit 780c794

Browse files
authored
Merge pull request freqtrade#12292 from freqtrade/maint/combine_ci
Combine CI definition
2 parents 730ccba + 8b4070d commit 780c794

File tree

1 file changed

+45
-194
lines changed

1 file changed

+45
-194
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ concurrency:
1919
permissions:
2020
repository-projects: read
2121
jobs:
22-
build-linux:
23-
22+
tests:
23+
name: "Tests and Linting"
2424
runs-on: ${{ matrix.os }}
2525
strategy:
2626
matrix:
27-
os: [ "ubuntu-22.04", "ubuntu-24.04" ]
27+
os: [ "ubuntu-22.04", "ubuntu-24.04", "macos-14", "macos-15" , "windows-2022", "windows-2025" ]
2828
python-version: ["3.11", "3.12", "3.13"]
2929

3030
steps:
@@ -46,7 +46,14 @@ jobs:
4646
cache-dependency-glob: "requirements**.txt"
4747
cache-suffix: "${{ matrix.python-version }}"
4848

49-
- name: Installation - *nix
49+
- name: Installation - macOS (Brew)
50+
if: ${{ runner.os == 'macOS' }}
51+
run: |
52+
# brew update
53+
# TODO: Should be the brew upgrade
54+
brew install libomp
55+
56+
- name: Installation (python)
5057
run: |
5158
uv pip install --upgrade wheel
5259
uv pip install -r requirements-dev.txt
@@ -60,7 +67,7 @@ jobs:
6067
- name: Tests
6168
if: (!(runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04'))
6269
run: |
63-
pytest --random-order
70+
pytest --random-order --durations 20 -n auto
6471
6572
- name: Tests with Coveralls
6673
if: (runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04')
@@ -87,9 +94,9 @@ jobs:
8794
run: |
8895
python build_helpers/create_command_partials.py
8996
90-
- name: Check for repository changes
97+
- name: Check for repository changes - *nix
9198
# TODO: python 3.13 slightly changed the output of argparse.
92-
if: (matrix.python-version != '3.13')
99+
if: ${{ (matrix.python-version != '3.13') && (runner.os != 'Windows') }}
93100
run: |
94101
if [ -n "$(git status --porcelain)" ]; then
95102
echo "Repository is dirty, changes detected:"
@@ -100,179 +107,8 @@ jobs:
100107
echo "Repository is clean, no changes detected."
101108
fi
102109
103-
- name: Backtesting (multi)
104-
run: |
105-
cp tests/testdata/config.tests.json config.json
106-
freqtrade create-userdir --userdir user_data
107-
freqtrade new-strategy -s AwesomeStrategy
108-
freqtrade new-strategy -s AwesomeStrategyMin --template minimal
109-
freqtrade backtesting --datadir tests/testdata --strategy-list AwesomeStrategy AwesomeStrategyMin -i 5m
110-
111-
- name: Hyperopt
112-
run: |
113-
cp tests/testdata/config.tests.json config.json
114-
freqtrade create-userdir --userdir user_data
115-
freqtrade hyperopt --datadir tests/testdata -e 6 --strategy SampleStrategy --hyperopt-loss SharpeHyperOptLossDaily --print-all
116-
117-
- name: Sort imports (isort)
118-
run: |
119-
isort --check .
120-
121-
- name: Run Ruff
122-
run: |
123-
ruff check --output-format=github
124-
125-
- name: Run Ruff format check
126-
run: |
127-
ruff format --check
128-
129-
- name: Mypy
130-
if: matrix.os == 'ubuntu-24.04'
131-
run: |
132-
mypy freqtrade scripts tests
133-
134-
- name: Discord notification
135-
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
136-
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
137-
with:
138-
severity: error
139-
details: Freqtrade CI failed on ${{ matrix.os }}
140-
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
141-
142-
build-macos:
143-
runs-on: ${{ matrix.os }}
144-
strategy:
145-
matrix:
146-
os: [ "macos-14", "macos-15" ]
147-
python-version: ["3.11", "3.12", "3.13"]
148-
149-
steps:
150-
- uses: actions/checkout@v5
151-
with:
152-
persist-credentials: false
153-
154-
- name: Set up Python
155-
uses: actions/setup-python@v6
156-
with:
157-
python-version: ${{ matrix.python-version }}
158-
check-latest: true
159-
160-
- name: Install uv
161-
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
162-
with:
163-
activate-environment: true
164-
enable-cache: true
165-
python-version: ${{ matrix.python-version }}
166-
cache-dependency-glob: "requirements**.txt"
167-
cache-suffix: "${{ matrix.python-version }}"
168-
169-
- name: Installation - macOS (Brew)
170-
run: |
171-
# brew update
172-
# TODO: Should be the brew upgrade
173-
brew install libomp
174-
175-
- name: Installation (python)
176-
run: |
177-
uv pip install wheel
178-
uv pip install -r requirements-dev.txt
179-
uv pip install -e ft_client/
180-
uv pip install -e .
181-
182-
- name: Tests
183-
run: |
184-
pytest --random-order
185-
186-
- name: Check for repository changes
187-
run: |
188-
if [ -n "$(git status --porcelain)" ]; then
189-
echo "Repository is dirty, changes detected:"
190-
git status
191-
git diff
192-
exit 1
193-
else
194-
echo "Repository is clean, no changes detected."
195-
fi
196-
197-
- name: Backtesting
198-
run: |
199-
cp tests/testdata/config.tests.json config.json
200-
freqtrade create-userdir --userdir user_data
201-
freqtrade new-strategy -s AwesomeStrategyAdv --template advanced
202-
freqtrade backtesting --datadir tests/testdata --strategy AwesomeStrategyAdv
203-
204-
- name: Hyperopt
205-
run: |
206-
cp tests/testdata/config.tests.json config.json
207-
freqtrade create-userdir --userdir user_data
208-
freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt-loss SharpeHyperOptLossDaily --print-all
209-
210-
- name: Sort imports (isort)
211-
run: |
212-
isort --check .
213-
214-
- name: Run Ruff
215-
run: |
216-
ruff check --output-format=github
217-
218-
- name: Run Ruff format check
219-
run: |
220-
ruff format --check
221-
222-
- name: Mypy
223-
if: matrix.os == 'macos-15'
224-
run: |
225-
mypy freqtrade scripts
226-
227-
- name: Discord notification
228-
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
229-
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
230-
with:
231-
severity: info
232-
details: Test Succeeded!
233-
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
234-
235-
build-windows:
236-
237-
runs-on: ${{ matrix.os }}
238-
strategy:
239-
matrix:
240-
os: [ "windows-2022", "windows-2025" ]
241-
python-version: ["3.11", "3.12", "3.13"]
242-
243-
steps:
244-
- uses: actions/checkout@v5
245-
with:
246-
persist-credentials: false
247-
248-
- name: Set up Python
249-
uses: actions/setup-python@v6
250-
with:
251-
python-version: ${{ matrix.python-version }}
252-
253-
- name: Install uv
254-
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
255-
with:
256-
activate-environment: true
257-
enable-cache: true
258-
python-version: ${{ matrix.python-version }}
259-
cache-dependency-glob: "requirements**.txt"
260-
cache-suffix: "${{ matrix.python-version }}"
261-
262-
- name: Installation
263-
run: |
264-
function uvpipFunction { uv pip $args }
265-
Set-Alias -name pip -value uvpipFunction
266-
267-
python -m pip install --upgrade pip
268-
pip install -r requirements-dev.txt
269-
pip install -e .
270-
271-
- name: Tests
272-
run: |
273-
pytest --random-order --durations 20 -n auto
274-
275-
- name: Check for repository changes
110+
- name: Check for repository changes - Windows
111+
if: ${{ runner.os == 'Windows' && (matrix.python-version != '3.13') }}
276112
run: |
277113
if (git status --porcelain) {
278114
Write-Host "Repository is dirty, changes detected:"
@@ -284,17 +120,24 @@ jobs:
284120
Write-Host "Repository is clean, no changes detected."
285121
}
286122
287-
- name: Backtesting
123+
- name: Backtesting (multi)
288124
run: |
289-
cp tests/testdata/config.tests.json config.json
290125
freqtrade create-userdir --userdir user_data
291-
freqtrade backtesting --datadir tests/testdata --strategy SampleStrategy
126+
cp tests/testdata/config.tests.json user_data/config.json
127+
freqtrade new-strategy -s AwesomeStrategy
128+
freqtrade new-strategy -s AwesomeStrategyMin --template minimal
129+
freqtrade new-strategy -s AwesomeStrategyAdv --template advanced
130+
freqtrade backtesting --datadir tests/testdata --strategy-list AwesomeStrategy AwesomeStrategyMin AwesomeStrategyAdv -i 5m
292131
293132
- name: Hyperopt
294133
run: |
295134
cp tests/testdata/config.tests.json config.json
296135
freqtrade create-userdir --userdir user_data
297-
freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt-loss SharpeHyperOptLossDaily --print-all
136+
freqtrade hyperopt --datadir tests/testdata -e 6 --strategy SampleStrategy --hyperopt-loss SharpeHyperOptLossDaily --print-all
137+
138+
- name: Sort imports (isort)
139+
run: |
140+
isort --check .
298141
299142
- name: Run Ruff
300143
run: |
@@ -305,10 +148,13 @@ jobs:
305148
ruff format --check
306149
307150
- name: Mypy
151+
if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-15' }}
308152
run: |
309153
mypy freqtrade scripts tests
310154
311155
- name: Run Pester tests (PowerShell)
156+
if: ${{ runner.os == 'Windows' }}
157+
shell: powershell
312158
run: |
313159
$PSVersionTable
314160
Set-PSRepository psgallery -InstallationPolicy trusted
@@ -317,18 +163,17 @@ jobs:
317163
Invoke-Pester -Path "tests" -CI
318164
if ($Error.Length -gt 0) {exit 1}
319165
320-
shell: powershell
321-
322166
- name: Discord notification
323167
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
324-
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
168+
if: ${{ failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) }}
325169
with:
326170
severity: error
327-
details: Test Failed
171+
details: Freqtrade CI failed on ${{ matrix.os }} with Python ${{ matrix.python-version }}!
328172
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
329173

330174
mypy-version-check:
331-
runs-on: ubuntu-22.04
175+
name: "Mypy Version Check"
176+
runs-on: ubuntu-24.04
332177
steps:
333178
- uses: actions/checkout@v5
334179
with:
@@ -345,6 +190,7 @@ jobs:
345190
python build_helpers/pre_commit_update.py
346191
347192
pre-commit:
193+
name: "Pre-commit checks"
348194
runs-on: ubuntu-22.04
349195
steps:
350196
- uses: actions/checkout@v5
@@ -357,6 +203,7 @@ jobs:
357203
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
358204

359205
docs-check:
206+
name: "Documentation build"
360207
runs-on: ubuntu-22.04
361208
steps:
362209
- uses: actions/checkout@v5
@@ -388,6 +235,7 @@ jobs:
388235

389236
build-linux-online:
390237
# Run pytest with "live" checks
238+
name: "Tests and Linting - Online tests"
391239
runs-on: ubuntu-24.04
392240
steps:
393241
- uses: actions/checkout@v5
@@ -425,9 +273,7 @@ jobs:
425273
# Notify only once - when CI completes (and after deploy) in case it's successful
426274
notify-complete:
427275
needs: [
428-
build-linux,
429-
build-macos,
430-
build-windows,
276+
tests,
431277
docs-check,
432278
mypy-version-check,
433279
pre-commit,
@@ -459,7 +305,7 @@ jobs:
459305

460306
build:
461307
name: "Build"
462-
needs: [ build-linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ]
308+
needs: [ tests, docs-check, mypy-version-check, pre-commit ]
463309
runs-on: ubuntu-22.04
464310

465311
steps:
@@ -556,7 +402,12 @@ jobs:
556402

557403
docker-build:
558404
name: "Docker Build and Deploy"
559-
needs: [ build-linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ]
405+
needs: [
406+
tests,
407+
docs-check,
408+
mypy-version-check,
409+
pre-commit
410+
]
560411
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/freqtrade'
561412
uses: ./.github/workflows/docker-build.yml
562413
permissions:

0 commit comments

Comments
 (0)