Skip to content

Update CI workflow to fetch core files from open_dev branch#399

Merged
geatpy-dev merged 1 commit intogeatpy-dev:masterfrom
WhiskyChoy:patch-2
Feb 5, 2026
Merged

Update CI workflow to fetch core files from open_dev branch#399
geatpy-dev merged 1 commit intogeatpy-dev:masterfrom
WhiskyChoy:patch-2

Conversation

@WhiskyChoy
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings February 5, 2026 12:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the CI workflow to fetch pre-built core binary files from a separate open_dev branch instead of building them locally. The workflow now pulls platform-specific compiled binaries and copies them to the appropriate location before building and testing.

Changes:

  • Changed Ubuntu runner from ubuntu-latest to ubuntu-20.04 to ensure Python 3.6 compatibility
  • Added step to fetch and checkout the _core directory from the open_dev branch
  • Added step to copy platform-specific core files from _core to geatpy/core based on OS and Python version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fi
PY_VERSION="v${{ matrix.python-version }}"
mkdir -p geatpy/core
cp -r "_core/${OS_DIR}/lib64/${PY_VERSION}/"* geatpy/core/
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copy operation lacks error handling and validation. If the source path "_core/${OS_DIR}/lib64/${PY_VERSION}/" doesn't exist or contains no files, the command will fail but the error may not be clear. Consider adding a check to verify the source directory exists and contains files before attempting the copy, or using 'set -e' to ensure the script fails fast on errors.

Suggested change
cp -r "_core/${OS_DIR}/lib64/${PY_VERSION}/"* geatpy/core/
SRC_DIR="_core/${OS_DIR}/lib64/${PY_VERSION}"
if [[ ! -d "$SRC_DIR" ]]; then
echo "Error: Source directory '$SRC_DIR' does not exist." >&2
exit 1
fi
shopt -s nullglob
files=("$SRC_DIR"/*)
if [[ ${#files[@]} -eq 0 ]]; then
echo "Error: No files found to copy in '$SRC_DIR'." >&2
exit 1
fi
cp -r "${files[@]}" geatpy/core/

Copilot uses AI. Check for mistakes.
Comment on lines +47 to +48
else
OS_DIR="Linux"
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script assumes that macOS runners will never be used. If the matrix is expanded to include macOS in the future, the OS_DIR will be set to "Linux" for macOS, which is likely incorrect. Consider adding an explicit check for macOS or documenting this limitation.

Suggested change
else
OS_DIR="Linux"
elif [[ "$RUNNER_OS" == "Linux" ]]; then
OS_DIR="Linux"
else
echo "Unsupported RUNNER_OS '$RUNNER_OS'. This workflow currently supports only Windows and Linux."
exit 1

Copilot uses AI. Check for mistakes.
Comment on lines +17 to 18
os: [ubuntu-20.04, windows-latest]
python-version: ["3.6"]
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python 3.6 reached end-of-life in December 2021 and is no longer supported. The change to ubuntu-20.04 may be to ensure Python 3.6 availability, but this creates a maintenance burden as ubuntu-20.04 itself will reach end-of-life soon (April 2025 for standard support). Consider upgrading to a supported Python version (3.8+) to ensure long-term maintainability and security.

Suggested change
os: [ubuntu-20.04, windows-latest]
python-version: ["3.6"]
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.11"]

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that the compiled core module are of python 3.6.

Comment on lines +29 to +30
git fetch origin open_dev
git checkout origin/open_dev -- _core
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git fetch and checkout operations lack error handling. If the 'open_dev' branch doesn't exist or the '_core' directory is not present in that branch, the workflow will fail silently or with unclear errors. Consider adding error handling to verify the branch exists and the checkout was successful before proceeding.

Suggested change
git fetch origin open_dev
git checkout origin/open_dev -- _core
set -e
# Verify that the remote branch 'open_dev' exists
if ! git ls-remote --exit-code origin open_dev >/dev/null 2>&1; then
echo "Error: remote branch 'open_dev' not found on 'origin'." >&2
exit 1
fi
# Fetch the latest state of the 'open_dev' branch
git fetch origin open_dev
# Attempt to check out the '_core' directory from the remote branch
if ! git checkout origin/open_dev -- _core; then
echo "Error: failed to check out '_core' directory from 'origin/open_dev'." >&2
exit 1
fi
# Verify that the '_core' directory now exists
if [ ! -d "_core" ]; then
echo "Error: '_core' directory not found after checkout. Verify it exists in the 'open_dev' branch." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
@geatpy-dev geatpy-dev merged commit 238d36b into geatpy-dev:master Feb 5, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants