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