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 | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 18 | - os: windows-latest |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 19 | python-version: 3.7 |
| 20 | - os: windows-latest |
| 21 | r-version: 3.6 |
| 22 | - os: ubuntu-20.04 |
| 23 | r-version: 4.0 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 24 | steps: |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 25 | - uses: actions/checkout@v2 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 26 | - name: Set up Python ${{ matrix.python-version }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 27 | uses: actions/setup-python@v2 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 28 | with: |
| 29 | python-version: ${{ matrix.python-version }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 30 | - 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 Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 40 | - name: Set up R ${{ matrix.r-version }} |
| 41 | uses: r-lib/actions/setup-r@master |
| 42 | with: |
| 43 | r-version: ${{ matrix.r-version }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 44 | 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 |
Marc Kupietz | 3cb8eba | 2020-06-20 15:36:47 +0200 | [diff] [blame] | 58 | key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 59 | if: runner.os == 'Linux' |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 60 | - name: Cache R packages |
| 61 | uses: actions/cache@v1 |
| 62 | with: |
| 63 | path: ${{ env.R_LIBS_USER }} |
Marc Kupietz | 3cb8eba | 2020-06-20 15:36:47 +0200 | [diff] [blame] | 64 | key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 65 | if: runner.os != 'Linux' |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 66 | - name: Install dependencies |
| 67 | run: | |
| 68 | python -m pip install --upgrade pip |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 69 | pip install wheel |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 70 | - name: Install package |
| 71 | run: | |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 72 | pip install . |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 73 | - 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 Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 77 | pip install pytest |
| 78 | pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 79 | - name: Test with pytest on Windows |
| 80 | if: runner.os == 'Windows' |
| 81 | run: | |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 82 | ./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 | |