Skip to content

Commit

Permalink
Update r_macos.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
davidycliao committed Jan 23, 2025
1 parent 45e0ff2 commit b868dc2
Showing 1 changed file with 15 additions and 31 deletions.
46 changes: 15 additions & 31 deletions .github/workflows/r_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,40 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
r-version: ['4.3.2', '4.2.0']
python-version: ['3.10']
r-version: ['4.2.0']
python-version: ['3.10'] # 文檔要求的 Python 版本
fail-fast: false

steps:
- name: Install system dependencies
run: |
brew install gettext
brew link gettext --force
brew install gcc
- name: Set up R ${{ matrix.r-version }}
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'
python-version: ${{ matrix.python-version }}
architecture: 'arm64'

- name: Verify Python installation
- name: Verify Python
run: |
python --version
which python
python -m pip --version
- name: Setup virtual environment
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}

- name: Install R dependencies
run: |
export PATH="/usr/local/opt/gettext/bin:$PATH"
python -m pip install --upgrade pip
python -m pip install virtualenv
python -m virtualenv r-reticulate
Rscript -e 'install.packages(c("reticulate", "remotes"), repos="https://cran.r-project.org")'
Rscript -e 'reticulate::py_config()'
- name: Test flaiR installation
- name: Install flaiR
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RETICULATE_PYTHON: ${{ github.workspace }}/r-reticulate/bin/python
run: |
export PATH="/usr/local/opt/gettext/bin:$PATH"
Rscript -e '
install.packages("remotes", repos="https://cran.r-project.org")
Sys.setenv(GITHUB_PAT = Sys.getenv("GITHUB_PAT"))
Sys.setenv(RETICULATE_PYTHON = Sys.getenv("RETICULATE_PYTHON"))
tryCatch({
remotes::install_github("davidycliao/flaiR", force = TRUE)
reticulate::py_config()
library(flaiR)
cat("flaiR installed and loaded successfully\n")
}, error = function(e) {
Expand All @@ -76,10 +62,8 @@ jobs:
- name: Print environment info
if: always()
run: |
brew list
R --version
python --version
echo "RETICULATE_PYTHON: $RETICULATE_PYTHON"
R --version
Rscript -e 'reticulate::py_config()'
# name: R-MacOS
Expand Down

0 comments on commit b868dc2

Please sign in to comment.