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: |
Marc Kupietz | d35b6e6 | 2020-07-31 13:05:35 +0200 | [diff] [blame^] | 10 | max-parallel: 4 |
Marc Kupietz | 602833a | 2020-07-31 12:41:32 +0200 | [diff] [blame] | 11 | fail-fast: false |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 12 | matrix: |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 13 | python-version: [3.7, 3.8] |
Marc Kupietz | 602833a | 2020-07-31 12:41:32 +0200 | [diff] [blame] | 14 | r-version: [3.6, release] |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 15 | os: [windows-latest, macOS-latest, ubuntu-20.04] |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 16 | exclude: |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 17 | - os: macOS-latest |
| 18 | python-version: 3.7 |
Marc Kupietz | 5ebaa4b | 2020-06-20 16:00:42 +0200 | [diff] [blame] | 19 | - os: macOS-latest |
Marc Kupietz | 602833a | 2020-07-31 12:41:32 +0200 | [diff] [blame] | 20 | r-version: 3.6 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 21 | - os: windows-latest |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 22 | python-version: 3.7 |
| 23 | - os: windows-latest |
| 24 | r-version: 3.6 |
| 25 | - os: ubuntu-20.04 |
Marc Kupietz | 602833a | 2020-07-31 12:41:32 +0200 | [diff] [blame] | 26 | r-version: 3.6 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 27 | steps: |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 28 | - uses: actions/checkout@v2 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 29 | - name: Set up Python ${{ matrix.python-version }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 30 | uses: actions/setup-python@v2 |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 31 | with: |
| 32 | python-version: ${{ matrix.python-version }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 33 | - name: Cache pip |
| 34 | uses: actions/cache@v2 |
| 35 | with: |
| 36 | # This path is specific to Ubuntu |
| 37 | path: ~/.cache/pip |
| 38 | # Look to see if there is a cache hit for the corresponding requirements file |
| 39 | key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} |
| 40 | restore-keys: | |
| 41 | ${{ runner.os }}-pip- |
| 42 | ${{ runner.os }}- |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 43 | - name: Set up R ${{ matrix.r-version }} |
| 44 | uses: r-lib/actions/setup-r@master |
| 45 | with: |
| 46 | r-version: ${{ matrix.r-version }} |
Marc Kupietz | d35b6e6 | 2020-07-31 13:05:35 +0200 | [diff] [blame^] | 47 | if: runner.os != 'LinuxDisabled' |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 48 | - name: Set up package maintainers R on Linux |
| 49 | run: | |
| 50 | sudo apt-get update -y |
| 51 | 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 |
| 52 | sudo chown $USER /usr/local/lib/R/site-library |
| 53 | export R_LIBS_USER=/usr/local/lib/R/site-library |
Marc Kupietz | d35b6e6 | 2020-07-31 13:05:35 +0200 | [diff] [blame^] | 54 | if: runner.os == 'LinuxDisabled' |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 55 | - name: Install R dependencies |
| 56 | run: Rscript -e "install.packages('RKorAPClient')" |
| 57 | - name: Cache R packages on Linux |
| 58 | uses: actions/cache@v1 |
| 59 | with: |
| 60 | path: /usr/local/lib/R/site-library |
Marc Kupietz | 3cb8eba | 2020-06-20 15:36:47 +0200 | [diff] [blame] | 61 | key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 62 | if: runner.os == 'Linux' |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 63 | - name: Cache R packages |
| 64 | uses: actions/cache@v1 |
| 65 | with: |
| 66 | path: ${{ env.R_LIBS_USER }} |
Marc Kupietz | 3cb8eba | 2020-06-20 15:36:47 +0200 | [diff] [blame] | 67 | key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }} |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 68 | if: runner.os != 'Linux' |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 69 | - name: Install dependencies |
| 70 | run: | |
| 71 | python -m pip install --upgrade pip |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 72 | pip install wheel |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 73 | - name: Install package |
| 74 | run: | |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 75 | pip install . |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 76 | - name: Test with pytest on POSIX |
| 77 | if: runner.os != 'Windows' |
| 78 | run: | |
| 79 | 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] | 80 | pip install pytest |
| 81 | pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml |
Marc Kupietz | 01f4160 | 2020-06-19 20:06:31 +0200 | [diff] [blame] | 82 | - name: Test with pytest on Windows |
| 83 | if: runner.os == 'Windows' |
| 84 | run: | |
Marc Kupietz | 6fc4b2a | 2020-06-20 17:31:24 +0200 | [diff] [blame] | 85 | pip install pytest |
| 86 | pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml |
| 87 | env: |
| 88 | R_HOME: "c:/R" |
| 89 | R_USER: "c:/R" |
Marc Kupietz | e8ca49f | 2020-06-24 14:45:10 +0200 | [diff] [blame] | 90 | PATH: "c:/R/bin/x64;${{ env.PATH }}" |
Marc Kupietz | cafdbb7 | 2020-06-27 18:54:46 +0200 | [diff] [blame] | 91 | - name: Build documentation un Linux |
| 92 | if: runner.os == 'Linux' |
| 93 | run: | |
| 94 | pip install pdoc3 |
| 95 | pdoc KorAPClient --force --html -o build/doc |
| 96 | - name: Deploy documentation on Linux |
| 97 | if: runner.os == 'Linux' |
| 98 | uses: JamesIves/github-pages-deploy-action@releases/v3 |
| 99 | with: |
| 100 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 101 | BRANCH: gh-pages # The branch the action should deploy to. |
| 102 | FOLDER: build/doc # The folder the action should deploy. |
| 103 | TARGET_FOLDER: doc |
Marc Kupietz | 1e0d3cd | 2020-06-19 23:38:13 +0200 | [diff] [blame] | 104 | - name: Upload check results |
| 105 | if: failure() |
| 106 | uses: actions/upload-artifact@master |
| 107 | with: |
| 108 | name: pytest-results-${{ matrix.python-version }} |
| 109 | path: junit/test-results-${{ matrix.python-version }}.xml |
| 110 | |