blob: 3a7288f0c001f67c6fac5503c92f21b33dd53121 [file] [log] [blame]
name: PythonKorAPClient CI unit test
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
fail-fast: false
matrix:
python-version: [3.9]
r-version: [release]
os: [windows-latest, macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2.3.4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.2.2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2.1.6
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 libsodium-dev libxml2-dev libcurl4-openssl-dev
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@v2.1.6
with:
path: /usr/local/lib/R/site-library
key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
if: runner.os == 'Linux'
- name: Cache R packages
uses: actions/cache@v2.1.6
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ 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: |
pip install pytest
pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
env:
R_HOME: "c:/R"
R_USER: "c:/R"
PATH: "c:/R/bin/x64;${{ env.PATH }}"
- name: Build documentation un Linux
if: runner.os == 'Linux'
run: |
pip install pdoc3
pdoc KorAPClient --force --html -o build/doc
- name: Deploy documentation on Linux
if: runner.os == 'Linux'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: build/doc # The folder the action should deploy.
TARGET_FOLDER: doc
- 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