blob: 2d51cb5eacfbc69dc8df83e77d85346dd8163f25 [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:
dependabot[bot]1bcac512021-05-12 04:08:31 +000029 - uses: actions/checkout@v2.3.4
Marc Kupietz01f41602020-06-19 20:06:31 +020030 - name: Set up Python ${{ matrix.python-version }}
dependabot[bot]287c94c2021-05-12 04:08:27 +000031 uses: actions/setup-python@v2.2.2
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
dependabot[bot]595bb722021-05-12 04:08:23 +000035 uses: actions/cache@v2.1.5
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020036 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 Kupietzd95b9472021-05-04 15:58:26 +020048 if: runner.os != 'Linux'
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020049 - name: Set up package maintainers R on Linux
50 run: |
51 sudo apt-get update -y
Marc Kupietzd95b9472021-05-04 15:58:26 +020052 sudo apt-get install -y libsodium-dev libxml2-dev libcurl4-openssl-dev
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020053 sudo chown $USER /usr/local/lib/R/site-library
54 export R_LIBS_USER=/usr/local/lib/R/site-library
Marc Kupietzd95b9472021-05-04 15:58:26 +020055 if: runner.os == 'Linux'
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
dependabot[bot]595bb722021-05-12 04:08:23 +000059 uses: actions/cache@v2.1.5
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020060 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
dependabot[bot]595bb722021-05-12 04:08:23 +000065 uses: actions/cache@v2.1.5
Marc Kupietz01f41602020-06-19 20:06:31 +020066 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