blob: 6eba34c7d32983c45f4087f08ffbddf6b5205daa [file] [log] [blame]
Marc Kupietz01f41602020-06-19 20:06:31 +02001name: PythonKorAPClient CI unit test
2
3on: [push, pull_request]
4
5jobs:
6 build:
7
8 runs-on: ${{ matrix.os }}
9 strategy:
Marc Kupietz602833a2020-07-31 12:41:32 +020010 fail-fast: false
Marc Kupietz01f41602020-06-19 20:06:31 +020011 matrix:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020012 python-version: [3.7, 3.8]
Marc Kupietz602833a2020-07-31 12:41:32 +020013 r-version: [3.6, release]
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020014 os: [windows-latest, macOS-latest, ubuntu-20.04]
Marc Kupietz01f41602020-06-19 20:06:31 +020015 exclude:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020016 - os: macOS-latest
17 python-version: 3.7
Marc Kupietz5ebaa4b2020-06-20 16:00:42 +020018 - os: macOS-latest
Marc Kupietz602833a2020-07-31 12:41:32 +020019 r-version: 3.6
Marc Kupietz01f41602020-06-19 20:06:31 +020020 - os: windows-latest
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020021 python-version: 3.7
22 - os: windows-latest
23 r-version: 3.6
24 - os: ubuntu-20.04
Marc Kupietz602833a2020-07-31 12:41:32 +020025 r-version: 3.6
Marc Kupietz01f41602020-06-19 20:06:31 +020026 steps:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020027 - uses: actions/checkout@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020028 - name: Set up Python ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020029 uses: actions/setup-python@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020030 with:
31 python-version: ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020032 - 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 Kupietz01f41602020-06-19 20:06:31 +020042 - name: Set up R ${{ matrix.r-version }}
43 uses: r-lib/actions/setup-r@master
44 with:
45 r-version: ${{ matrix.r-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020046 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 Kupietz3cb8eba2020-06-20 15:36:47 +020060 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020061 if: runner.os == 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020062 - name: Cache R packages
63 uses: actions/cache@v1
64 with:
65 path: ${{ env.R_LIBS_USER }}
Marc Kupietz3cb8eba2020-06-20 15:36:47 +020066 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020067 if: runner.os != 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020068 - name: Install dependencies
69 run: |
70 python -m pip install --upgrade pip
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020071 pip install wheel
Marc Kupietz01f41602020-06-19 20:06:31 +020072 - name: Install package
73 run: |
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020074 pip install .
Marc Kupietz01f41602020-06-19 20:06:31 +020075 - 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 Kupietz1e0d3cd2020-06-19 23:38:13 +020079 pip install pytest
80 pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
Marc Kupietz01f41602020-06-19 20:06:31 +020081 - name: Test with pytest on Windows
82 if: runner.os == 'Windows'
83 run: |
Marc Kupietz6fc4b2a2020-06-20 17:31:24 +020084 pip install pytest
85 pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
86 env:
87 R_HOME: "c:/R"
88 R_USER: "c:/R"
Marc Kupietze8ca49f2020-06-24 14:45:10 +020089 PATH: "c:/R/bin/x64;${{ env.PATH }}"
Marc Kupietzcafdbb72020-06-27 18:54:46 +020090 - name: Build documentation un Linux
91 if: runner.os == 'Linux'
92 run: |
93 pip install pdoc3
94 pdoc KorAPClient --force --html -o build/doc
95 - name: Deploy documentation on Linux
96 if: runner.os == 'Linux'
97 uses: JamesIves/github-pages-deploy-action@releases/v3
98 with:
99 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100 BRANCH: gh-pages # The branch the action should deploy to.
101 FOLDER: build/doc # The folder the action should deploy.
102 TARGET_FOLDER: doc
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +0200103 - name: Upload check results
104 if: failure()
105 uses: actions/upload-artifact@master
106 with:
107 name: pytest-results-${{ matrix.python-version }}
108 path: junit/test-results-${{ matrix.python-version }}.xml
109