From 6dc71269a2a7f099018f7e7daff1bc6f726aa6b2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 27 Sep 2025 15:54:27 +0200 Subject: [PATCH 1/7] chore(ci): simplify actions by combining linux and macOS runs --- .github/workflows/ci.yml | 122 +++++++-------------------------------- 1 file changed, 21 insertions(+), 101 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11f8a8cad..1e19b5c00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ "ubuntu-22.04", "ubuntu-24.04" ] + os: [ "ubuntu-22.04", "ubuntu-24.04", "macos-14", "macos-15" ] python-version: ["3.11", "3.12", "3.13"] steps: @@ -46,7 +46,14 @@ jobs: cache-dependency-glob: "requirements**.txt" cache-suffix: "${{ matrix.python-version }}" - - name: Installation - *nix + - name: Installation - macOS (Brew) + if: ${{ runner.os == 'macOS' }} + run: | + # brew update + # TODO: Should be the brew upgrade + brew install libomp + + - name: Installation (python) run: | uv pip install --upgrade wheel uv pip install -r requirements-dev.txt @@ -102,11 +109,12 @@ jobs: - name: Backtesting (multi) run: | - cp tests/testdata/config.tests.json config.json freqtrade create-userdir --userdir user_data + cp tests/testdata/config.tests.json user_data/config.json freqtrade new-strategy -s AwesomeStrategy freqtrade new-strategy -s AwesomeStrategyMin --template minimal - freqtrade backtesting --datadir tests/testdata --strategy-list AwesomeStrategy AwesomeStrategyMin -i 5m + freqtrade new-strategy -s AwesomeStrategyAdv --template advanced + freqtrade backtesting --datadir tests/testdata --strategy-list AwesomeStrategy AwesomeStrategyMin AwesomeStrategyAdv -i 5m - name: Hyperopt run: | @@ -127,7 +135,7 @@ jobs: ruff format --check - name: Mypy - if: matrix.os == 'ubuntu-24.04' + if: matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-15' run: | mypy freqtrade scripts tests @@ -139,99 +147,6 @@ jobs: details: Freqtrade CI failed on ${{ matrix.os }} webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} - build-macos: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ "macos-14", "macos-15" ] - python-version: ["3.11", "3.12", "3.13"] - - steps: - - uses: actions/checkout@v5 - with: - persist-credentials: false - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - check-latest: true - - - name: Install uv - uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.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 - macOS (Brew) - run: | - # brew update - # TODO: Should be the brew upgrade - brew install libomp - - - name: Installation (python) - run: | - uv pip install wheel - uv pip install -r requirements-dev.txt - uv pip install -e ft_client/ - uv pip install -e . - - - name: Tests - run: | - pytest --random-order - - - name: Check for repository changes - run: | - if [ -n "$(git status --porcelain)" ]; then - echo "Repository is dirty, changes detected:" - git status - git diff - exit 1 - else - echo "Repository is clean, no changes detected." - fi - - - name: Backtesting - run: | - cp tests/testdata/config.tests.json config.json - freqtrade create-userdir --userdir user_data - freqtrade new-strategy -s AwesomeStrategyAdv --template advanced - freqtrade backtesting --datadir tests/testdata --strategy AwesomeStrategyAdv - - - name: Hyperopt - run: | - cp tests/testdata/config.tests.json config.json - freqtrade create-userdir --userdir user_data - freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt-loss SharpeHyperOptLossDaily --print-all - - - name: Sort imports (isort) - run: | - isort --check . - - - name: Run Ruff - run: | - ruff check --output-format=github - - - name: Run Ruff format check - run: | - ruff format --check - - - name: Mypy - if: matrix.os == 'macos-15' - run: | - mypy freqtrade scripts - - - 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: info - details: Test Succeeded! - webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} - build-windows: runs-on: ${{ matrix.os }} @@ -426,7 +341,6 @@ jobs: notify-complete: needs: [ build-linux, - build-macos, build-windows, docs-check, mypy-version-check, @@ -459,7 +373,7 @@ jobs: build: name: "Build" - needs: [ build-linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ] + needs: [ build-linux, build-windows, docs-check, mypy-version-check, pre-commit ] runs-on: ubuntu-22.04 steps: @@ -556,7 +470,13 @@ jobs: docker-build: name: "Docker Build and Deploy" - needs: [ build-linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ] + needs: [ + build-linux, + build-windows, + docs-check, + mypy-version-check, + pre-commit + ] if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/freqtrade' uses: ./.github/workflows/docker-build.yml permissions: From d4462ba5d8401584a0bfc9ccf1ba332e1613b3f1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 27 Sep 2025 15:55:23 +0200 Subject: [PATCH 2/7] chore(ci): remove useless alias --- .github/workflows/ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e19b5c00..8101e8bbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -176,12 +176,8 @@ jobs: - name: Installation run: | - function uvpipFunction { uv pip $args } - Set-Alias -name pip -value uvpipFunction - - python -m pip install --upgrade pip - pip install -r requirements-dev.txt - pip install -e . + uv pip install -r requirements-dev.txt + uv pip install -e . - name: Tests run: | From 4e1d75a3e111a84d549faa7f16387b5720ac4864 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 27 Sep 2025 16:01:04 +0200 Subject: [PATCH 3/7] chore(ci): improved job naming --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8101e8bbe..e03701f2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ concurrency: permissions: repository-projects: read jobs: - build-linux: + tests: runs-on: ${{ matrix.os }} strategy: @@ -336,7 +336,7 @@ jobs: # Notify only once - when CI completes (and after deploy) in case it's successful notify-complete: needs: [ - build-linux, + tests, build-windows, docs-check, mypy-version-check, @@ -369,7 +369,7 @@ jobs: build: name: "Build" - needs: [ build-linux, build-windows, docs-check, mypy-version-check, pre-commit ] + needs: [ tests, build-windows, docs-check, mypy-version-check, pre-commit ] runs-on: ubuntu-22.04 steps: @@ -467,7 +467,7 @@ jobs: docker-build: name: "Docker Build and Deploy" needs: [ - build-linux, + tests, build-windows, docs-check, mypy-version-check, From f5002929ee638a6d2569c570f8eec0ae5e593904 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 27 Sep 2025 16:03:00 +0200 Subject: [PATCH 4/7] chore(ci): name some jobs properly --- .github/workflows/ci.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e03701f2d..4d4f68c9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ permissions: repository-projects: read jobs: tests: - + name: "Tests and Linting" runs-on: ${{ matrix.os }} strategy: matrix: @@ -148,7 +148,7 @@ jobs: webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} build-windows: - + name: "Tests and Linting - Windows" runs-on: ${{ matrix.os }} strategy: matrix: @@ -239,7 +239,8 @@ jobs: webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} mypy-version-check: - runs-on: ubuntu-22.04 + name: "Mypy Version Check" + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 with: @@ -256,6 +257,7 @@ jobs: python build_helpers/pre_commit_update.py pre-commit: + name: "Pre-commit checks" runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v5 @@ -268,6 +270,7 @@ jobs: - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 docs-check: + name: "Documentation build" runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v5 @@ -299,6 +302,7 @@ jobs: build-linux-online: # Run pytest with "live" checks + name: "Tests and Linting - Online tests" runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 From f454006ec3766fa674731cf4f82088aaa065f74c Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 27 Sep 2025 16:51:00 +0200 Subject: [PATCH 5/7] chore(ci): combine windows ci into generic test runner --- .github/workflows/ci.yml | 98 ++++------------------------------------ 1 file changed, 8 insertions(+), 90 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d4f68c9f..ac526f5bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ "ubuntu-22.04", "ubuntu-24.04", "macos-14", "macos-15" ] + os: [ "ubuntu-22.04", "ubuntu-24.04", "macos-14", "macos-15" , "windows-2022", "windows-2025" ] python-version: ["3.11", "3.12", "3.13"] steps: @@ -67,7 +67,7 @@ jobs: - name: Tests if: (!(runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04')) run: | - pytest --random-order + pytest --random-order --durations 20 - name: Tests with Coveralls if: (runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04') @@ -135,91 +135,13 @@ jobs: ruff format --check - name: Mypy - if: matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-15' - run: | - mypy freqtrade scripts tests - - - 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: Freqtrade CI failed on ${{ matrix.os }} - webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} - - build-windows: - name: "Tests and Linting - Windows" - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ "windows-2022", "windows-2025" ] - python-version: ["3.11", "3.12", "3.13"] - - steps: - - uses: actions/checkout@v5 - with: - persist-credentials: false - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - - name: Install uv - uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.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 - run: | - uv pip install -r requirements-dev.txt - uv pip install -e . - - - name: Tests - run: | - pytest --random-order --durations 20 -n auto - - - name: Check for repository changes - run: | - if (git status --porcelain) { - Write-Host "Repository is dirty, changes detected:" - git status - git diff - exit 1 - } - else { - Write-Host "Repository is clean, no changes detected." - } - - - name: Backtesting - run: | - cp tests/testdata/config.tests.json config.json - freqtrade create-userdir --userdir user_data - freqtrade backtesting --datadir tests/testdata --strategy SampleStrategy - - - name: Hyperopt - run: | - cp tests/testdata/config.tests.json config.json - freqtrade create-userdir --userdir user_data - freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt-loss SharpeHyperOptLossDaily --print-all - - - name: Run Ruff - run: | - ruff check --output-format=github - - - name: Run Ruff format check - run: | - ruff format --check - - - name: Mypy + if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-15' }} run: | mypy freqtrade scripts tests - name: Run Pester tests (PowerShell) + if: ${{ runner.os == 'Windows' }} + shell: powershell run: | $PSVersionTable Set-PSRepository psgallery -InstallationPolicy trusted @@ -228,14 +150,12 @@ jobs: Invoke-Pester -Path "tests" -CI if ($Error.Length -gt 0) {exit 1} - shell: powershell - - 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) + if: ${{ failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) }} with: severity: error - details: Test Failed + details: Freqtrade CI failed on ${{ matrix.os }} with Python ${{ matrix.python-version }}! webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} mypy-version-check: @@ -341,7 +261,6 @@ jobs: notify-complete: needs: [ tests, - build-windows, docs-check, mypy-version-check, pre-commit, @@ -373,7 +292,7 @@ jobs: build: name: "Build" - needs: [ tests, build-windows, docs-check, mypy-version-check, pre-commit ] + needs: [ tests, docs-check, mypy-version-check, pre-commit ] runs-on: ubuntu-22.04 steps: @@ -472,7 +391,6 @@ jobs: name: "Docker Build and Deploy" needs: [ tests, - build-windows, docs-check, mypy-version-check, pre-commit From 4e089fd17e79fe4b322aa3e675c8df86200aeddb Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 27 Sep 2025 17:23:16 +0200 Subject: [PATCH 6/7] chore(ci): split check between windows and linux --- .github/workflows/ci.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac526f5bc..4363db62b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: - name: Check for repository changes # TODO: python 3.13 slightly changed the output of argparse. - if: (matrix.python-version != '3.13') + if: ${{ (matrix.python-version != '3.13') && (runner.os != 'Windows') }} run: | if [ -n "$(git status --porcelain)" ]; then echo "Repository is dirty, changes detected:" @@ -107,6 +107,19 @@ jobs: echo "Repository is clean, no changes detected." fi + - name: Check for repository changes + if: ${{ runner.os == 'Windows' && (matrix.python-version != '3.13') }} + run: | + if (git status --porcelain) { + Write-Host "Repository is dirty, changes detected:" + git status + git diff + exit 1 + } + else { + Write-Host "Repository is clean, no changes detected." + } + - name: Backtesting (multi) run: | freqtrade create-userdir --userdir user_data From 8b4070dbcfbd932e3de7318826da2221b48422a0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 27 Sep 2025 18:04:43 +0200 Subject: [PATCH 7/7] chore(ci): parallel tests --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4363db62b..7fbfbc735 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: - name: Tests if: (!(runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04')) run: | - pytest --random-order --durations 20 + pytest --random-order --durations 20 -n auto - name: Tests with Coveralls if: (runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04') @@ -94,7 +94,7 @@ jobs: run: | python build_helpers/create_command_partials.py - - name: Check for repository changes + - name: Check for repository changes - *nix # TODO: python 3.13 slightly changed the output of argparse. if: ${{ (matrix.python-version != '3.13') && (runner.os != 'Windows') }} run: | @@ -107,7 +107,7 @@ jobs: echo "Repository is clean, no changes detected." fi - - name: Check for repository changes + - name: Check for repository changes - Windows if: ${{ runner.os == 'Windows' && (matrix.python-version != '3.13') }} run: | if (git status --porcelain) {