From 29f90cbd048352461728ff04c6870216d6e09078 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 9 Mar 2024 17:34:06 +0100 Subject: [PATCH 1/5] Run CI on macos-14 (M1) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0587525e..bb1058afb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,7 +124,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ "macos-latest", "macos-13" ] + os: [ "macos-latest", "macos-13", "macos-14" ] python-version: ["3.9", "3.10", "3.11", "3.12"] steps: From cc3b2000eb1f13dd22e1cfbb370d3993a65319ca Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 9 Mar 2024 17:55:22 +0100 Subject: [PATCH 2/5] Avoid fully patching torch on M1 macs --- tests/freqai/conftest.py | 7 ++++++- tests/freqai/test_freqai_interface.py | 10 ++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/freqai/conftest.py b/tests/freqai/conftest.py index 81d72d92a..55f0296a3 100644 --- a/tests/freqai/conftest.py +++ b/tests/freqai/conftest.py @@ -25,10 +25,15 @@ def is_mac() -> bool: return "Darwin" in machine +def is_arm() -> bool: + machine = platform.machine() + return "arm" in machine or "aarch64" in machine + + @pytest.fixture(autouse=True) def patch_torch_initlogs(mocker) -> None: - if is_mac(): + if is_mac() and not is_arm(): # Mock torch import completely import sys import types diff --git a/tests/freqai/test_freqai_interface.py b/tests/freqai/test_freqai_interface.py index 58648d97f..2a71e8af6 100644 --- a/tests/freqai/test_freqai_interface.py +++ b/tests/freqai/test_freqai_interface.py @@ -1,5 +1,4 @@ import logging -import platform import shutil from pathlib import Path from unittest.mock import MagicMock @@ -15,13 +14,8 @@ from freqtrade.optimize.backtesting import Backtesting from freqtrade.persistence import Trade from freqtrade.plugins.pairlistmanager import PairListManager from tests.conftest import EXMS, create_mock_trades, get_patched_exchange, log_has_re -from tests.freqai.conftest import (get_patched_freqai_strategy, is_mac, is_py12, make_rl_config, - mock_pytorch_mlp_model_training_parameters) - - -def is_arm() -> bool: - machine = platform.machine() - return "arm" in machine or "aarch64" in machine +from tests.freqai.conftest import (get_patched_freqai_strategy, is_arm, is_mac, is_py12, + make_rl_config, mock_pytorch_mlp_model_training_parameters) def can_run_model(model: str) -> None: From edc74ae2e460bb2c6bf051c11cb4a58d122d90d2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 9 Mar 2024 18:23:35 +0100 Subject: [PATCH 3/5] Split macos Installation into 2 separate actions --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb1058afb..fc3886b32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,7 +154,7 @@ jobs: run: | cd build_helpers && ./install_ta-lib.sh ${HOME}/dependencies/; cd .. - - name: Installation - macOS + - name: Installation - macOS (Brew) run: | # brew update # TODO: Should be the brew upgrade @@ -177,6 +177,9 @@ jobs: rm /usr/local/bin/python3.12-config || true brew install hdf5 c-blosc libomp + + - name: Installation (python) + run: | python -m pip install --upgrade pip wheel export LD_LIBRARY_PATH=${HOME}/dependencies/lib:$LD_LIBRARY_PATH export TA_LIBRARY_PATH=${HOME}/dependencies/lib From 0bd50a6e2479e68caeed95f269f3a80447b65f75 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 9 Mar 2024 19:44:40 +0100 Subject: [PATCH 4/5] Don't disable tensorboard on mac ARM --- tests/freqai/test_freqai_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/freqai/test_freqai_interface.py b/tests/freqai/test_freqai_interface.py index 2a71e8af6..fb7af5853 100644 --- a/tests/freqai/test_freqai_interface.py +++ b/tests/freqai/test_freqai_interface.py @@ -237,7 +237,7 @@ def test_extract_data_and_train_model_Classifiers(mocker, freqai_conf, model): def test_start_backtesting(mocker, freqai_conf, model, num_files, strat, caplog): can_run_model(model) test_tb = True - if is_mac(): + if is_mac() and not is_arm(): test_tb = False freqai_conf.get("freqai", {}).update({"save_backtest_models": True}) From 4e94178169f910c7a665f689d3a625f7d7b43449 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 9 Mar 2024 20:10:40 +0100 Subject: [PATCH 5/5] exclude python 3.9 on Macos 14 --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc3886b32..44f489346 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,6 +126,9 @@ jobs: matrix: os: [ "macos-latest", "macos-13", "macos-14" ] python-version: ["3.9", "3.10", "3.11", "3.12"] + exclude: + - os: "macos-14" + python-version: "3.9" steps: - uses: actions/checkout@v4