blob: 184e527838bec849ade5a9e5123cadd39b6bdc6f [file] [log] [blame]
name: PythonKorAPClient CI unit test
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 6
fail-fast: false
matrix:
python-version: ['3.9', '3.11', '3.12']
r-version: [release]
os: [windows-latest, macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Set up R ${{ matrix.r-version }}
uses: r-lib/actions/setup-r@v2
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@v3
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@v3
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 on Mac and Linux
if: runner.os != 'Windows'
run: |
pip install .
- name: Install package on Windows
if: runner.os == 'Windows'
run: |
pip install rpy2
pip install .
env:
R_HOME: "c:/R"
R_USER: "c:/R"
PATH: "c:/R/bin/x64;${{ env.PATH }}"
- 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@v3
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml