-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* **Bug-fix (#45: The failing tests on macOS is on the side of Python on imbalanced class-wise classification. Commit a9bddd5 confirms this. *Upgrading Python did not make a difference.* **Fix:** Add guards similar to `fbeta()` to capture unpredictable behavior. * **Streamlined and split workflows:** All reticulate relatetd workflows uses a composite action to minimize the amount of coding and updating python related workflows. MacOS have been removed from the primary package check as this is most prone to error. They have been split between clang and gcc compilers for future guides on OpenMP enabled Macbooks and tests. * **Updated Python Version:** Python is now 3.12 --------- Signed-off-by: Serkan Korkmaz <[email protected]>
- Loading branch information
Showing
7 changed files
with
236 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: "Setup {reticulate} environment" | ||
|
||
description: "Sets up Python and Reticulate virtual environment for R projects." | ||
inputs: | ||
python-version: | ||
description: "Python version to install" | ||
required: true | ||
default: "3.12.x" | ||
|
||
outputs: | ||
reticulate-python: | ||
description: "Path to the Reticulate Python environment" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install system dependencies (Ubuntu only) | ||
if: runner.os == 'Linux' | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y python3-venv | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Setup venv with {Reticulate} | ||
shell: Rscript {0} | ||
env: | ||
PYTHON_VERSION: ${{ inputs.python-version }} | ||
run: | | ||
# 1) get python version | ||
# NOTE: it's on the form 3.12.x | ||
python_version <- paste0(">=",gsub( | ||
pattern = ".x", | ||
replacement = "", | ||
x = Sys.getenv("PYTHON_VERSION") | ||
)) | ||
# 2) create virtual environment | ||
# with specified version | ||
path_to_python <- reticulate::virtualenv_create( | ||
envname = "r-reticulate", | ||
python_version = python_version, | ||
packages = c( | ||
"numpy", | ||
"scipy", | ||
"torch", | ||
"torchmetrics", | ||
"scikit-learn", | ||
"imblearn" | ||
) | ||
) | ||
writeLines( | ||
sprintf("RETICULATE_PYTHON=%s", path_to_python), | ||
Sys.getenv("GITHUB_ENV") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [development] | ||
pull_request: | ||
branches: [development] | ||
|
||
name: macOS-clang | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: macOS-clang | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: macos-latest, r: 'release'} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup pandoc | ||
uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- name: Setup R | ||
uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
http-user-agent: ${{ matrix.config.http-user-agent }} | ||
use-public-rspm: true | ||
|
||
- name: Installing {pkgs} | ||
uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck reticulate | ||
needs: check | ||
|
||
- name: Setup Python and {reticulate} | ||
uses: ./.github/actions/setup-reticulate | ||
|
||
- name: R CMD check | ||
uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true | ||
build_args: 'c("--no-manual", "--compact-vignettes=gs+qpdf")' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [development] | ||
pull_request: | ||
branches: [development] | ||
|
||
name: macOS-gcc | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: macOS-gcc | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: macos-latest, r: 'release'} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install GCC on macOS | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew update | ||
brew install gcc | ||
- name: Set GCC as Default Compiler on macOS | ||
if: runner.os == 'macOS' | ||
run: | | ||
# Identify the installed GCC version | ||
GCC_VERSION=$(brew list gcc | grep bin/gcc- | head -n1 | sed 's#.*/gcc-##') | ||
echo "Detected GCC version: $GCC_VERSION" | ||
# Set CC and CXX environment variables | ||
echo "CC=$(brew --prefix gcc)/bin/gcc-$GCC_VERSION" >> $GITHUB_ENV | ||
echo "CXX=$(brew --prefix gcc)/bin/g++-$GCC_VERSION" >> $GITHUB_ENV | ||
echo "$(brew --prefix gcc)/bin" >> $GITHUB_PATH | ||
- name: Setup pandoc | ||
uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- name: Setup R | ||
uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
http-user-agent: ${{ matrix.config.http-user-agent }} | ||
use-public-rspm: true | ||
|
||
- name: Installing {pkgs} | ||
uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck reticulate | ||
needs: check | ||
|
||
- name: Setup Python and {reticulate} | ||
uses: ./.github/actions/setup-reticulate | ||
|
||
- name: R CMD check | ||
uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true | ||
build_args: 'c("--no-manual", "--compact-vignettes=gs+qpdf")' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.