Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 1 | name: PythonKorAPClient CI unit test |
| 2 | |
| 3 | on: [push, pull_request] |
| 4 | |
| 5 | jobs: |
| 6 | build: |
| 7 | |
| 8 | runs-on: ${{ matrix.os }} |
| 9 | strategy: |
| 10 | max-parallel: 4 |
| 11 | matrix: |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 12 | python-version: [3.7, 3.8] |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 13 | r-version: [3.6, 4.0] |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 14 | os: [windows-latest, macOS-latest, ubuntu-20.04] |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 15 | exclude: |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 16 | - os: macOS-latest |
| 17 | python-version: 3.7 |
Marc Kupietz | 5ebaa4b | 2020-06-20 16:00:42 +0200 | [diff] [blame] | 18 | - os: macOS-latest |
Marc Kupietz | f78db63 | 2020-06-20 16:13:12 +0200 | [diff] [blame^] | 19 | r-version: 4.0 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 20 | - os: windows-latest |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 21 | python-version: 3.7 |
| 22 | - os: windows-latest |
| 23 | r-version: 3.6 |
| 24 | - os: ubuntu-20.04 |
| 25 | r-version: 4.0 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 26 | steps: |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 27 | - uses: actions/checkout@v2 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 28 | - name: Set up Python ${{ matrix.python-version }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 29 | uses: actions/setup-python@v2 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 30 | with: |
| 31 | python-version: ${{ matrix.python-version }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 32 | - 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 Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 42 | - name: Set up R ${{ matrix.r-version }} |
| 43 | uses: r-lib/actions/setup-r@master |
| 44 | with: |
| 45 | r-version: ${{ matrix.r-version }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 46 | 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 Kupietz | 3cb8eba | 2020-06-20 15:36:47 +0200 | [diff] [blame] | 60 | key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 61 | if: runner.os == 'Linux' |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 62 | - name: Cache R packages |
| 63 | uses: actions/cache@v1 |
| 64 | with: |
| 65 | path: ${{ env.R_LIBS_USER }} |
Marc Kupietz | 3cb8eba | 2020-06-20 15:36:47 +0200 | [diff] [blame] | 66 | key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 67 | if: runner.os != 'Linux' |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 68 | - name: Install dependencies |
| 69 | run: | |
| 70 | python -m pip install --upgrade pip |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 71 | pip install wheel |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 72 | - name: Install package |
| 73 | run: | |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 74 | pip install . |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 75 | - 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 Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 79 | pip install pytest |
| 80 | pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 81 | - name: Test with pytest on Windows |
| 82 | if: runner.os == 'Windows' |
| 83 | run: | |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 84 | ./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 | |