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