Skip to content

Merge pull request #235 from davidycliao/0.0.7 #759

Merge pull request #235 from davidycliao/0.0.7

Merge pull request #235 from davidycliao/0.0.7 #759

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# See https://github.com/r-lib/actions/tree/master/examples#readme for
# additional example workflows available for the R community.
# name: R-MacOS
#
# on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
#
# permissions:
# contents: read
#
# jobs:
# build:
# runs-on: macos-latest
#
# strategy:
# matrix:
# r-version: ['4.4.0', '4.3.2']
#
# steps:
# - uses: actions/checkout@v3
#
# - name: Update Homebrew
# run: |
# brew update
#
# - name: Install pandoc
# run: |
# for i in {1..3}; do
# brew install pandoc && break || sleep 15
# done
#
# - name: Install gfortran and configure Makevars
# run: |
# brew install gcc
# mkdir -p ~/.R
# touch ~/.R/Makevars
# echo "FC=$(brew --prefix)/bin/gfortran" >> ~/.R/Makevars
# echo "F77=$(brew --prefix)/bin/gfortran" >> ~/.R/Makevars
# echo "FLIBS=-L$(brew --prefix)/lib/gcc/current -lgfortran -lquadmath -lm" >> ~/.R/Makevars
# echo "LDFLAGS=-L$(brew --prefix)/lib/gcc/current" >> ~/.R/Makevars
#
# - name: Set up R ${{ matrix.r-version }}
# uses: r-lib/actions/setup-r@v2
# with:
# r-version: ${{ matrix.r-version }}
#
# - name: Install R dependencies
# run: |
# Rscript -e "install.packages(c('remotes', 'rcmdcheck', 'reticulate', 'renv', 'knitr', 'rmarkdown', 'lsa', 'purrr', 'testthat', 'htmltools'), repos='https://cran.r-project.org')"
# Rscript -e "if (getRversion() >= '4.4.0') remotes::install_version('Matrix', version = '1.5.3') else install.packages('Matrix', type = 'binary')"
# Rscript -e "remotes::install_version('htmltools', version = '0.5.8')"
# Rscript -e "renv::restore()"
#
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: '3.10.x'
#
# - name: Install Python virtualenv
# run: pip install virtualenv
#
# - name: Create Python virtual environment
# run: virtualenv flair_env
#
# - name: Install Python dependencies in virtual environment
# run: |
# source flair_env/bin/activate
# pip install --upgrade pip
# pip install scipy==1.12.0
# pip install flair
#
# - name: Remove Python cache files
# run: find . -name '*.pyc' -delete
#
# - name: Check (with virtual environment)
# run: |
# source flair_env/bin/activate
# R CMD build --no-build-vignettes .
# shell: bash
# name: R-MacOS
#
# on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
#
# permissions:
# contents: read
#
# jobs:
# build:
# runs-on: macos-latest
# strategy:
# matrix:
# r-version: ['4.4.0', '4.3.2']
# fail-fast: false
#
# steps:
# - uses: actions/checkout@v3
#
# - name: Update Homebrew
# run: brew update
#
# - name: Install pandoc
# run: |
# for i in {1..3}
# do
# brew install pandoc && break || sleep 15
# done
#
# - name: Install gfortran and configure Makevars
# run: |
# brew install gcc
# mkdir -p ~/.R
# touch ~/.R/Makevars
# echo "FC=$(brew --prefix)/bin/gfortran" >> ~/.R/Makevars
# echo "F77=$(brew --prefix)/bin/gfortran" >> ~/.R/Makevars
# echo "FLIBS=-L$(brew --prefix)/lib/gcc/current -lgfortran -lquadmath -lm" >> ~/.R/Makevars
# echo "LDFLAGS=-L$(brew --prefix)/lib/gcc/current" >> ~/.R/Makevars
#
# - name: Set up R ${{ matrix.r-version }}
# uses: r-lib/actions/setup-r@v2
# with:
# r-version: ${{ matrix.r-version }}
#
# - name: Install R dependencies
# run: |
# # 基礎包安裝
# Rscript -e 'install.packages(c("remotes", "rcmdcheck", "reticulate", "renv", "knitr", "rmarkdown", "lsa", "purrr", "testthat"), repos="https://cran.r-project.org")'
#
# # 根據 R 版本有條件地安裝 Matrix
# Rscript -e '
# if (getRversion() >= "4.4.0") {
# install.packages("Matrix")
# } else {
# remotes::install_version("Matrix", version = "1.5.1", repos = "https://cran.r-project.org")
# }
# '
#
# # 安裝指定版本的 htmltools
# Rscript -e 'remotes::install_version("htmltools", version = "0.5.8")'
#
# # 最後執行 renv::restore()
# Rscript -e 'renv::restore()'
#
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: '3.10.x'
#
# - name: Install Python virtualenv
# run: pip install virtualenv
#
# - name: Create Python virtual environment
# run: virtualenv flair_env
#
# - name: Install Python dependencies in virtual environment
# run: |
# source flair_env/bin/activate
# pip install --upgrade pip
# pip install scipy==1.12.0
# pip install flair
#
# - name: Remove Python cache files
# run: find . -name '*.pyc' -delete
#
# - name: Check (with virtual environment)
# run: |
# source flair_env/bin/activate
# R CMD build --no-build-vignettes .
# shell: bash
name: R-MacOS
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: macos-latest
strategy:
matrix:
r-version: ['4.4.0', '4.2.3'] # 改為 4.2.3
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Update Homebrew
run: brew update
- name: Install pandoc
run: |
for i in {1..3}
do
brew install pandoc && break || sleep 15
done
- name: Install gfortran and configure Makevars
run: |
brew install gcc
mkdir -p ~/.R
touch ~/.R/Makevars
echo "FC=$(brew --prefix)/bin/gfortran" >> ~/.R/Makevars
echo "F77=$(brew --prefix)/bin/gfortran" >> ~/.R/Makevars
echo "FLIBS=-L$(brew --prefix)/lib/gcc/current -lgfortran -lquadmath -lm" >> ~/.R/Makevars
echo "LDFLAGS=-L$(brew --prefix)/lib/gcc/current" >> ~/.R/Makevars
- name: Set up R ${{ matrix.r-version }}
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
- name: Install R dependencies
run: |
# 首先安裝基礎包
Rscript -e 'install.packages(c("remotes", "rcmdcheck", "reticulate", "renv"), repos="https://cran.r-project.org")'
# 根據 R 版本安裝相應的 Matrix 版本
Rscript -e '
if (getRversion() >= "4.4.0") {
remotes::install_version("Matrix", version = "1.5-3")
} else if (getRversion() >= "4.2.0" && getRversion() < "4.3.0") {
remotes::install_version("Matrix", version = "1.4-1")
} else {
remotes::install_version("Matrix", version = "1.5-1")
}
'
# 安裝其他依賴
Rscript -e 'install.packages(c("knitr", "rmarkdown", "lsa", "purrr", "testthat"), repos="https://cran.r-project.org")'
# 安裝特定版本的 htmltools
Rscript -e 'remotes::install_version("htmltools", version = "0.5.8")'
# renv 相關操作
Rscript -e '
tryCatch({
renv::restore()
}, error = function(e) {
message("Error in renv::restore(): ", e$message)
if (!requireNamespace("Matrix", quietly = TRUE)) {
if (getRversion() >= "4.4.0") {
install.packages("Matrix")
} else if (getRversion() >= "4.2.0" && getRversion() < "4.3.0") {
remotes::install_version("Matrix", version = "1.4-1")
} else {
remotes::install_version("Matrix", version = "1.5-1")
}
}
})
'
- name: Set up Python
uses: actions/setup-python@v4 # 更新到 v4
with:
python-version: '3.10.x'
cache: 'pip'
- name: Install Python virtualenv
run: pip install virtualenv
- name: Create Python virtual environment
run: virtualenv flair_env
- name: Install Python dependencies in virtual environment
run: |
source flair_env/bin/activate
pip install --upgrade pip
pip install scipy==1.12.0
pip install flair
deactivate
- name: Remove Python cache files
run: find . -name '*.pyc' -delete
- name: Check (with virtual environment)
run: |
source flair_env/bin/activate
set -e
R CMD build --no-build-vignettes .
shell: bash