blob: 0dc1ba5216bfa6a21e0d290fb5be5e4146d1006e [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 Kupietzd35b6e62020-07-31 13:05:35 +020010 max-parallel: 4
Marc Kupietz602833a2020-07-31 12:41:32 +020011 fail-fast: false
Marc Kupietz01f41602020-06-19 20:06:31 +020012 matrix:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020013 python-version: [3.7, 3.8]
Marc Kupietz602833a2020-07-31 12:41:32 +020014 r-version: [3.6, release]
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020015 os: [windows-latest, macOS-latest, ubuntu-20.04]
Marc Kupietz01f41602020-06-19 20:06:31 +020016 exclude:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020017 - os: macOS-latest
18 python-version: 3.7
Marc Kupietz5ebaa4b2020-06-20 16:00:42 +020019 - os: macOS-latest
Marc Kupietz602833a2020-07-31 12:41:32 +020020 r-version: 3.6
Marc Kupietz01f41602020-06-19 20:06:31 +020021 - os: windows-latest
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020022 python-version: 3.7
23 - os: windows-latest
24 r-version: 3.6
25 - os: ubuntu-20.04
Marc Kupietz602833a2020-07-31 12:41:32 +020026 r-version: 3.6
Marc Kupietz01f41602020-06-19 20:06:31 +020027 steps:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020028 - uses: actions/checkout@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020029 - name: Set up Python ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020030 uses: actions/setup-python@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020031 with:
32 python-version: ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020033 - 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 Kupietz01f41602020-06-19 20:06:31 +020043 - name: Set up R ${{ matrix.r-version }}
44 uses: r-lib/actions/setup-r@master
45 with:
46 r-version: ${{ matrix.r-version }}
Marc Kupietzd35b6e62020-07-31 13:05:35 +020047 if: runner.os != 'LinuxDisabled'
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020048 - 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 Kupietzd35b6e62020-07-31 13:05:35 +020054 if: runner.os == 'LinuxDisabled'
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020055 - 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 Kupietz3cb8eba2020-06-20 15:36:47 +020061 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020062 if: runner.os == 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020063 - name: Cache R packages
64 uses: actions/cache@v1
65 with:
66 path: ${{ env.R_LIBS_USER }}
Marc Kupietz3cb8eba2020-06-20 15:36:47 +020067 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020068 if: runner.os != 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020069 - name: Install dependencies
70 run: |
71 python -m pip install --upgrade pip
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020072 pip install wheel
Marc Kupietz01f41602020-06-19 20:06:31 +020073 - name: Install package
74 run: |
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020075 pip install .
Marc Kupietz01f41602020-06-19 20:06:31 +020076 - 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 Kupietz1e0d3cd2020-06-19 23:38:13 +020080 pip install pytest
81 pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
Marc Kupietz01f41602020-06-19 20:06:31 +020082 - name: Test with pytest on Windows
83 if: runner.os == 'Windows'
84 run: |
Marc Kupietz6fc4b2a2020-06-20 17:31:24 +020085 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 Kupietze8ca49f2020-06-24 14:45:10 +020090 PATH: "c:/R/bin/x64;${{ env.PATH }}"
Marc Kupietzcafdbb72020-06-27 18:54:46 +020091 - 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 Kupietz1e0d3cd2020-06-19 23:38:13 +0200104 - 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