From 98c72aee659c6a1d89bcd003b7033f7e5e54db27 Mon Sep 17 00:00:00 2001 From: Weilin Cai <220019066@link.cuhk.edu.cn> Date: Thu, 5 Feb 2026 21:16:55 +0800 Subject: [PATCH 1/9] Use container for python 3.6 compatibility issue --- .github/workflows/build_and_test.yml | 106 +++++++++++++++++++-------- 1 file changed, 77 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e87ca4f3..4fa480d7 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -14,47 +14,95 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-latest] + os: [ubuntu-latest, windows-latest] python-version: ["3.6"] - defaults: - run: - shell: bash + runs-on: ${{ matrix.os }} timeout-minutes: 30 + + container: ${{ matrix.os == 'ubuntu-latest' && 'ubuntu:20.04' || '' }} + steps: - uses: actions/checkout@v3 - - - name: Fetch core files from open_dev branch + + - name: Fetch core files from open_dev branch (Linux) + if: runner.os == 'Linux' + shell: bash + run: | + git fetch origin open_dev + git checkout origin/open_dev -- _core + + - name: Fetch core files from open_dev branch (Windows) + if: runner.os == 'Windows' + shell: pwsh run: | git fetch origin open_dev git checkout origin/open_dev -- _core - - - name: Set up Python ${{ matrix.python-version }} + + - name: Install Python 3.6 (Linux) + if: runner.os == 'Linux' + shell: bash + run: | + apt-get update + apt-get install -y python3.6 python3.6-dev python3-pip git + python3.6 -m pip install --upgrade pip + + - name: Set up Python 3.6 (Windows) + if: runner.os == 'Windows' uses: actions/setup-python@v3 with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - pip install cython setuptools - pip install -r requirements.txt - pip install pytest - - - name: Copy core files to geatpy/core - run: | - if [[ "$RUNNER_OS" == "Windows" ]]; then - OS_DIR="Windows" - else - OS_DIR="Linux" - fi - PY_VERSION="v${{ matrix.python-version }}" + python-version: "3.6" + + - name: Install dependencies (Linux) + if: runner.os == 'Linux' + shell: bash + run: | + python3.6 -m pip install cython setuptools + python3.6 -m pip install -r requirements.txt + python3.6 -m pip install pytest + + - name: Install dependencies (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + python -m pip install cython setuptools + python -m pip install -r requirements.txt + python -m pip install pytest + + - name: Copy core files to geatpy/core (Linux) + if: runner.os == 'Linux' + shell: bash + run: | mkdir -p geatpy/core - cp -r "_core/${OS_DIR}/lib64/${PY_VERSION}/"* geatpy/core/ - - - name: Build + cp -r "_core/Linux/lib64/v3.6/"* geatpy/core/ + + - name: Copy core files to geatpy/core (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path geatpy/core | Out-Null + Copy-Item -Recurse -Force "_core\Windows\lib64\v3.6\*" "geatpy\core\" + + - name: Build (Linux) + if: runner.os == 'Linux' + shell: bash + run: python3.6 setup.py install + + - name: Build (Windows) + if: runner.os == 'Windows' + shell: pwsh run: python setup.py install - - - name: Test with pytest + + - name: Test with pytest (Linux) + if: runner.os == 'Linux' + shell: bash + run: | + python3.6 -m geatpy --version + python3.6 -m pytest + + - name: Test with pytest (Windows) + if: runner.os == 'Windows' + shell: pwsh run: | python -m geatpy --version pytest From 479483d16a8938ad0503ce093944def9acb61850 Mon Sep 17 00:00:00 2001 From: Weilin Cai <220019066@link.cuhk.edu.cn> Date: Thu, 5 Feb 2026 21:21:36 +0800 Subject: [PATCH 2/9] Update .github/workflows/build_and_test.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build_and_test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4fa480d7..4800e0cc 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -49,7 +49,9 @@ jobs: - name: Set up Python 3.6 (Windows) if: runner.os == 'Windows' - uses: actions/setup-python@v3 + # Python 3.6 is required for compatibility with existing core libraries. + # Use setup-python@v2 because v3+ no longer supports installing Python 3.6. + uses: actions/setup-python@v2 with: python-version: "3.6" From 55a7a81659bddd1892503d7153909affdd156086 Mon Sep 17 00:00:00 2001 From: Weilin Cai <220019066@link.cuhk.edu.cn> Date: Thu, 5 Feb 2026 21:21:50 +0800 Subject: [PATCH 3/9] Update .github/workflows/build_and_test.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4800e0cc..a7dbddf5 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -107,4 +107,4 @@ jobs: shell: pwsh run: | python -m geatpy --version - pytest + python -m pytest From f570cd5d69f367fa5cc7850bdd3fc85fcd641f09 Mon Sep 17 00:00:00 2001 From: Weilin Cai <220019066@link.cuhk.edu.cn> Date: Thu, 5 Feb 2026 21:22:07 +0800 Subject: [PATCH 4/9] Update .github/workflows/build_and_test.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build_and_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index a7dbddf5..2931cf83 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -44,7 +44,8 @@ jobs: shell: bash run: | apt-get update - apt-get install -y python3.6 python3.6-dev python3-pip git + apt-get install -y python3.6 python3.6-dev python3.6-distutils python3.6-venv python3-pip git curl + curl https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3.6 python3.6 -m pip install --upgrade pip - name: Set up Python 3.6 (Windows) From c3fd15cc030832d2a297b9dbc92b5c6172dfd5c9 Mon Sep 17 00:00:00 2001 From: Weilin Cai <220019066@link.cuhk.edu.cn> Date: Thu, 5 Feb 2026 21:29:27 +0800 Subject: [PATCH 5/9] Refactor build and test workflow for Linux setup --- .github/workflows/build_and_test.yml | 30 ++++++++++------------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 2931cf83..722a4a45 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -23,35 +23,27 @@ jobs: container: ${{ matrix.os == 'ubuntu-latest' && 'ubuntu:20.04' || '' }} steps: - - uses: actions/checkout@v3 - - - name: Fetch core files from open_dev branch (Linux) + - name: Prepare tools (Linux) if: runner.os == 'Linux' shell: bash run: | - git fetch origin open_dev - git checkout origin/open_dev -- _core + apt-get update + apt-get install -y git ca-certificates curl python3.6 python3.6-dev python3-pip + curl -sSL https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3.6 + python3.6 -m pip install --upgrade pip - - name: Fetch core files from open_dev branch (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - git fetch origin open_dev - git checkout origin/open_dev -- _core + - uses: actions/checkout@v3 + with: + fetch-depth: 0 - - name: Install Python 3.6 (Linux) - if: runner.os == 'Linux' + - name: Fetch core files from open_dev branch shell: bash run: | - apt-get update - apt-get install -y python3.6 python3.6-dev python3.6-distutils python3.6-venv python3-pip git curl - curl https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3.6 - python3.6 -m pip install --upgrade pip + git fetch origin open_dev + git checkout origin/open_dev -- _core - name: Set up Python 3.6 (Windows) if: runner.os == 'Windows' - # Python 3.6 is required for compatibility with existing core libraries. - # Use setup-python@v2 because v3+ no longer supports installing Python 3.6. uses: actions/setup-python@v2 with: python-version: "3.6" From ce4d98c1e1fb6ccddccaa11ed397d345bf3cb34f Mon Sep 17 00:00:00 2001 From: Weilin Cai <220019066@link.cuhk.edu.cn> Date: Thu, 5 Feb 2026 21:31:35 +0800 Subject: [PATCH 6/9] Modify Python 3.6 installation in CI workflow Updated the installation process for Python 3.6 and its dependencies. --- .github/workflows/build_and_test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 722a4a45..6e922946 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -28,7 +28,10 @@ jobs: shell: bash run: | apt-get update - apt-get install -y git ca-certificates curl python3.6 python3.6-dev python3-pip + apt-get install -y git ca-certificates curl gnupg software-properties-common + add-apt-repository ppa:deadsnakes/ppa -y + apt-get update + apt-get install -y python3.6 python3.6-dev python3.6-distutils curl -sSL https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3.6 python3.6 -m pip install --upgrade pip From 2af7efb45f880faa5df5f6835632a903f2b3cd60 Mon Sep 17 00:00:00 2001 From: Weilin Cai <220019066@link.cuhk.edu.cn> Date: Thu, 5 Feb 2026 21:35:11 +0800 Subject: [PATCH 7/9] Configure environment for Linux build and test Add environment variables for non-interactive installation and timezone setup. --- .github/workflows/build_and_test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6e922946..6536523d 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -26,12 +26,20 @@ jobs: - name: Prepare tools (Linux) if: runner.os == 'Linux' shell: bash + env: + DEBIAN_FRONTEND: noninteractive + TZ: Etc/UTC run: | apt-get update + apt-get install -y tzdata + ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime + dpkg-reconfigure -f noninteractive tzdata + apt-get install -y git ca-certificates curl gnupg software-properties-common add-apt-repository ppa:deadsnakes/ppa -y apt-get update apt-get install -y python3.6 python3.6-dev python3.6-distutils + curl -sSL https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3.6 python3.6 -m pip install --upgrade pip From 18583ed39990f4e136aa5a29cd3a169c8b4f87af Mon Sep 17 00:00:00 2001 From: Weilin Cai <220019066@link.cuhk.edu.cn> Date: Thu, 5 Feb 2026 21:39:14 +0800 Subject: [PATCH 8/9] Update Python compilation installation in CI workflow Replaced Python installation method with source compilation and added necessary dependencies. --- .github/workflows/build_and_test.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6536523d..8ab515e7 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -34,13 +34,23 @@ jobs: apt-get install -y tzdata ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime dpkg-reconfigure -f noninteractive tzdata - - apt-get install -y git ca-certificates curl gnupg software-properties-common - add-apt-repository ppa:deadsnakes/ppa -y - apt-get update - apt-get install -y python3.6 python3.6-dev python3.6-distutils - - curl -sSL https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3.6 + + apt-get install -y git ca-certificates curl build-essential wget \ + libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ + libffi-dev libncursesw5-dev xz-utils tk-dev liblzma-dev uuid-dev + + wget -q https://www.python.org/ftp/python/3.6.15/Python-3.6.15.tgz + tar -xzf Python-3.6.15.tgz + cd Python-3.6.15 + ./configure --prefix=/opt/python36 --enable-shared --with-ensurepip=install + make -j$(nproc) + make install + cd .. + + echo "/opt/python36/lib" > /etc/ld.so.conf.d/python36.conf + ldconfig + + ln -sf /opt/python36/bin/python3.6 /usr/local/bin/python3.6 python3.6 -m pip install --upgrade pip - uses: actions/checkout@v3 From 5760e740b1f0794165787a0ee035172eee082f4a Mon Sep 17 00:00:00 2001 From: Weilin Cai <220019066@link.cuhk.edu.cn> Date: Thu, 5 Feb 2026 21:43:47 +0800 Subject: [PATCH 9/9] Refactor build_and_test.yml --- .github/workflows/build_and_test.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 8ab515e7..2fb660ce 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -34,11 +34,13 @@ jobs: apt-get install -y tzdata ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime dpkg-reconfigure -f noninteractive tzdata - + apt-get install -y git ca-certificates curl build-essential wget \ libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ libffi-dev libncursesw5-dev xz-utils tk-dev liblzma-dev uuid-dev - + + git config --global --add safe.directory /__w/geatpy/geatpy + wget -q https://www.python.org/ftp/python/3.6.15/Python-3.6.15.tgz tar -xzf Python-3.6.15.tgz cd Python-3.6.15 @@ -46,10 +48,10 @@ jobs: make -j$(nproc) make install cd .. - + echo "/opt/python36/lib" > /etc/ld.so.conf.d/python36.conf ldconfig - + ln -sf /opt/python36/bin/python3.6 /usr/local/bin/python3.6 python3.6 -m pip install --upgrade pip