blob: d0c5dd51f0893a064c15dca120f10dc96fc5cd64 [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 Kupietz01f41602020-06-19 20:06:31 +020018 - os: windows-latest
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020019 python-version: 3.7
20 - os: windows-latest
21 r-version: 3.6
22 - os: ubuntu-20.04
23 r-version: 4.0
Marc Kupietz01f41602020-06-19 20:06:31 +020024 steps:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020025 - uses: actions/checkout@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020026 - name: Set up Python ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020027 uses: actions/setup-python@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020028 with:
29 python-version: ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020030 - name: Cache pip
31 uses: actions/cache@v2
32 with:
33 # This path is specific to Ubuntu
34 path: ~/.cache/pip
35 # Look to see if there is a cache hit for the corresponding requirements file
36 key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
37 restore-keys: |
38 ${{ runner.os }}-pip-
39 ${{ runner.os }}-
Marc Kupietz01f41602020-06-19 20:06:31 +020040 - name: Set up R ${{ matrix.r-version }}
41 uses: r-lib/actions/setup-r@master
42 with:
43 r-version: ${{ matrix.r-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020044 if: runner.os != 'Linux'
45 - name: Set up package maintainers R on Linux
46 run: |
47 sudo apt-get update -y
48 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
49 sudo chown $USER /usr/local/lib/R/site-library
50 export R_LIBS_USER=/usr/local/lib/R/site-library
51 if: runner.os == 'Linux'
52 - name: Install R dependencies
53 run: Rscript -e "install.packages('RKorAPClient')"
54 - name: Cache R packages on Linux
55 uses: actions/cache@v1
56 with:
57 path: /usr/local/lib/R/site-library
58 key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('DESCRIPTION') }}
59 if: runner.os == 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020060 - name: Cache R packages
61 uses: actions/cache@v1
62 with:
63 path: ${{ env.R_LIBS_USER }}
64 key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020065 if: runner.os != 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020066 - name: Install dependencies
67 run: |
68 python -m pip install --upgrade pip
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020069 pip install wheel
Marc Kupietz01f41602020-06-19 20:06:31 +020070 - name: Install package
71 run: |
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020072 pip install .
Marc Kupietz01f41602020-06-19 20:06:31 +020073 - name: Test with pytest on POSIX
74 if: runner.os != 'Windows'
75 run: |
76 export LD_LIBRARY_PATH=$(python -m rpy2.situation LD_LIBRARY_PATH):${LD_LIBRARY_PATH}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020077 pip install pytest
78 pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
Marc Kupietz01f41602020-06-19 20:06:31 +020079 - name: Test with pytest on Windows
80 if: runner.os == 'Windows'
81 run: |
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020082 ./scripts/R_run.bat setup.py test
83 - name: Upload check results
84 if: failure()
85 uses: actions/upload-artifact@master
86 with:
87 name: pytest-results-${{ matrix.python-version }}
88 path: junit/test-results-${{ matrix.python-version }}.xml
89