blob: ece6bfeec947a3d6f2621fb3521f5c98ab7f6405 [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 Kupietz45b52062021-05-04 08:09:01 +020013 python-version: [3.9, 3.8]
Marc Kupietz602833a2020-07-31 12:41:32 +020014 r-version: [3.6, release]
Marc Kupietzcdeea612021-05-04 13:33:27 +020015 os: [windows-latest, macOS-latest, ubuntu-latest]
Marc Kupietz01f41602020-06-19 20:06:31 +020016 exclude:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020017 - os: macOS-latest
Marc Kupietzcdeea612021-05-04 13:33:27 +020018 python-version: 3.8
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 Kupietz45b52062021-05-04 08:09:01 +020022 python-version: 3.9
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020023 - os: windows-latest
24 r-version: 3.6
Marc Kupietzdc311952020-07-31 13:11:00 +020025 - os: ubuntu-latest
Marc Kupietz602833a2020-07-31 12:41:32 +020026 r-version: 3.6
Marc Kupietzcdeea612021-05-04 13:33:27 +020027 python-version: 3.9
Marc Kupietz01f41602020-06-19 20:06:31 +020028 steps:
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020029 - uses: actions/checkout@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020030 - name: Set up Python ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020031 uses: actions/setup-python@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020032 with:
33 python-version: ${{ matrix.python-version }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020034 - 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 Kupietz01f41602020-06-19 20:06:31 +020044 - name: Set up R ${{ matrix.r-version }}
45 uses: r-lib/actions/setup-r@master
46 with:
47 r-version: ${{ matrix.r-version }}
Marc Kupietzd35b6e62020-07-31 13:05:35 +020048 if: runner.os != 'LinuxDisabled'
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020049 - name: Set up package maintainers R on Linux
50 run: |
51 sudo apt-get update -y
52 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
53 sudo chown $USER /usr/local/lib/R/site-library
54 export R_LIBS_USER=/usr/local/lib/R/site-library
Marc Kupietzd35b6e62020-07-31 13:05:35 +020055 if: runner.os == 'LinuxDisabled'
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020056 - 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 Kupietz3cb8eba2020-06-20 15:36:47 +020062 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020063 if: runner.os == 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020064 - name: Cache R packages
65 uses: actions/cache@v1
66 with:
67 path: ${{ env.R_LIBS_USER }}
Marc Kupietz3cb8eba2020-06-20 15:36:47 +020068 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020069 if: runner.os != 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020070 - name: Install dependencies
71 run: |
72 python -m pip install --upgrade pip
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020073 pip install wheel
Marc Kupietz01f41602020-06-19 20:06:31 +020074 - name: Install package
75 run: |
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020076 pip install .
Marc Kupietz01f41602020-06-19 20:06:31 +020077 - 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 Kupietz1e0d3cd2020-06-19 23:38:13 +020081 pip install pytest
82 pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
Marc Kupietz01f41602020-06-19 20:06:31 +020083 - name: Test with pytest on Windows
84 if: runner.os == 'Windows'
85 run: |
Marc Kupietz6fc4b2a2020-06-20 17:31:24 +020086 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 Kupietze8ca49f2020-06-24 14:45:10 +020091 PATH: "c:/R/bin/x64;${{ env.PATH }}"
Marc Kupietzcafdbb72020-06-27 18:54:46 +020092 - 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 Kupietz1e0d3cd2020-06-19 23:38:13 +0200105 - 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