blob: 75b59c32c305249b947ffbfabfe8e484769dcbb7 [file] [log] [blame]
Marc Kupietz01f41602020-06-19 20:06:31 +02001name: PythonKorAPClient CI unit test
2
3on: [push, pull_request]
4
5jobs:
6 build:
7
8 runs-on: ${{ matrix.os }}
9 strategy:
10 max-parallel: 4
11 matrix:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020012 python-version: [3.7, 3.8]
Marc Kupietz01f41602020-06-19 20:06:31 +020013 r-version: [3.6, 4.0]
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020014 os: [windows-latest, macOS-latest, ubuntu-20.04]
Marc Kupietz01f41602020-06-19 20:06:31 +020015 exclude:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020016 - os: macOS-latest
17 python-version: 3.7
Marc Kupietz5ebaa4b2020-06-20 16:00:42 +020018 - os: macOS-latest
Marc Kupietzf78db632020-06-20 16:13:12 +020019 r-version: 4.0
Marc Kupietz01f41602020-06-19 20:06:31 +020020 - os: windows-latest
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020021 python-version: 3.7
22 - os: windows-latest
23 r-version: 3.6
24 - os: ubuntu-20.04
25 r-version: 4.0
Marc Kupietz01f41602020-06-19 20:06:31 +020026 steps:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020027 - uses: actions/checkout@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020028 - name: Set up Python ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020029 uses: actions/setup-python@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020030 with:
31 python-version: ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020032 - name: Cache pip
33 uses: actions/cache@v2
34 with:
35 # This path is specific to Ubuntu
36 path: ~/.cache/pip
37 # Look to see if there is a cache hit for the corresponding requirements file
38 key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
39 restore-keys: |
40 ${{ runner.os }}-pip-
41 ${{ runner.os }}-
Marc Kupietz01f41602020-06-19 20:06:31 +020042 - name: Set up R ${{ matrix.r-version }}
43 uses: r-lib/actions/setup-r@master
44 with:
45 r-version: ${{ matrix.r-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020046 if: runner.os != 'Linux'
47 - name: Set up package maintainers R on Linux
48 run: |
49 sudo apt-get update -y
50 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
51 sudo chown $USER /usr/local/lib/R/site-library
52 export R_LIBS_USER=/usr/local/lib/R/site-library
53 if: runner.os == 'Linux'
54 - name: Install R dependencies
55 run: Rscript -e "install.packages('RKorAPClient')"
56 - name: Cache R packages on Linux
57 uses: actions/cache@v1
58 with:
59 path: /usr/local/lib/R/site-library
Marc Kupietz3cb8eba2020-06-20 15:36:47 +020060 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020061 if: runner.os == 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020062 - name: Cache R packages
63 uses: actions/cache@v1
64 with:
65 path: ${{ env.R_LIBS_USER }}
Marc Kupietz3cb8eba2020-06-20 15:36:47 +020066 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020067 if: runner.os != 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020068 - name: Install dependencies
69 run: |
70 python -m pip install --upgrade pip
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020071 pip install wheel
Marc Kupietz01f41602020-06-19 20:06:31 +020072 - name: Install package
73 run: |
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020074 pip install .
Marc Kupietz01f41602020-06-19 20:06:31 +020075 - name: Test with pytest on POSIX
76 if: runner.os != 'Windows'
77 run: |
78 export LD_LIBRARY_PATH=$(python -m rpy2.situation LD_LIBRARY_PATH):${LD_LIBRARY_PATH}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020079 pip install pytest
80 pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
Marc Kupietz01f41602020-06-19 20:06:31 +020081 - name: Test with pytest on Windows
82 if: runner.os == 'Windows'
83 run: |
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020084 ./scripts/R_run.bat setup.py test
85 - name: Upload check results
86 if: failure()
87 uses: actions/upload-artifact@master
88 with:
89 name: pytest-results-${{ matrix.python-version }}
90 path: junit/test-results-${{ matrix.python-version }}.xml
91