blob: d0c5dd51f0893a064c15dca120f10dc96fc5cd64 [file] [log] [blame]
name: PythonKorAPClient CI unit test
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8]
r-version: [3.6, 4.0]
os: [windows-latest, macOS-latest, ubuntu-20.04]
exclude:
- os: macOS-latest
python-version: 3.7
- os: windows-latest
python-version: 3.7
- os: windows-latest
r-version: 3.6
- os: ubuntu-20.04
r-version: 4.0
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Set up R ${{ matrix.r-version }}
uses: r-lib/actions/setup-r@master
with:
r-version: ${{ matrix.r-version }}
if: runner.os != 'Linux'
- name: Set up package maintainers R on Linux
run: |
sudo apt-get update -y
sudo apt-get install -y r-base r-base-dev r-cran-tidyverse r-cran-r.utils r-cran-pixmap r-cran-webshot r-cran-ade4 r-cran-segmented r-cran-purrr r-cran-dygraphs r-cran-cvst r-cran-quantmod r-cran-graphlayouts r-cran-rappdirs r-cran-ggdendro r-cran-seqinr r-cran-heatmaply r-cran-igraph r-cran-plotly libcurl4-gnutls-dev libssl-dev libxml2-dev libsodium-dev python3-pip python3-rpy2 python3-pandas
sudo chown $USER /usr/local/lib/R/site-library
export R_LIBS_USER=/usr/local/lib/R/site-library
if: runner.os == 'Linux'
- name: Install R dependencies
run: Rscript -e "install.packages('RKorAPClient')"
- name: Cache R packages on Linux
uses: actions/cache@v1
with:
path: /usr/local/lib/R/site-library
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('DESCRIPTION') }}
if: runner.os == 'Linux'
- name: Cache R packages
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('DESCRIPTION') }}
if: runner.os != 'Linux'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
- name: Install package
run: |
pip install .
- name: Test with pytest on POSIX
if: runner.os != 'Windows'
run: |
export LD_LIBRARY_PATH=$(python -m rpy2.situation LD_LIBRARY_PATH):${LD_LIBRARY_PATH}
pip install pytest
pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Test with pytest on Windows
if: runner.os == 'Windows'
run: |
./scripts/R_run.bat setup.py test
- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml