blob: d151456f6e1493a3c06d41947c0b92edc61d86f8 [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 Kupietz6f2bdae2022-01-20 12:19:23 +010010 max-parallel: 6
Marc Kupietz602833a2020-07-31 12:41:32 +020011 fail-fast: false
Marc Kupietz01f41602020-06-19 20:06:31 +020012 matrix:
Marc Kupietzf84baac2024-01-26 09:20:00 +010013 python-version: ['3.9', '3.11', '3.12']
Marc Kupietzf573f8f2021-10-02 21:46:22 +020014 r-version: [release]
Marc Kupietzcdeea612021-05-04 13:33:27 +020015 os: [windows-latest, macOS-latest, ubuntu-latest]
Marc Kupietz01f41602020-06-19 20:06:31 +020016 steps:
Marc Kupietzf84baac2024-01-26 09:20:00 +010017 - uses: actions/checkout@v4
Marc Kupietz01f41602020-06-19 20:06:31 +020018 - name: Set up Python ${{ matrix.python-version }}
Marc Kupietzf84baac2024-01-26 09:20:00 +010019 uses: actions/setup-python@v5
Marc Kupietz01f41602020-06-19 20:06:31 +020020 with:
21 python-version: ${{ matrix.python-version }}
Marc Kupietzf84baac2024-01-26 09:20:00 +010022 cache: 'pip' # caching pip dependencies
Marc Kupietz01f41602020-06-19 20:06:31 +020023 - name: Set up R ${{ matrix.r-version }}
Marc Kupietzfaa9f652022-12-22 11:00:55 +010024 uses: r-lib/actions/setup-r@v2
Marc Kupietz01f41602020-06-19 20:06:31 +020025 with:
26 r-version: ${{ matrix.r-version }}
Marc Kupietz1e23bf52024-01-26 11:16:30 +010027 use-public-rspm: true
28 cache-version: 2
29 - uses: r-lib/actions/setup-r-dependencies@v2
30 with:
31 extra-packages: any::RKorAPClient
Marc Kupietzd95b9472021-05-04 15:58:26 +020032 if: runner.os != 'Linux'
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020033 - name: Set up package maintainers R on Linux
34 run: |
35 sudo apt-get update -y
Marc Kupietz1e23bf52024-01-26 11:16:30 +010036 sudo apt-get install -y libglpk-dev libsodium-dev libxml2-dev libcurl4-openssl-dev
37 sudo chown $(whoami) /usr/local/lib/R/site-library
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020038 export R_LIBS_USER=/usr/local/lib/R/site-library
Marc Kupietzd95b9472021-05-04 15:58:26 +020039 if: runner.os == 'Linux'
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020040 - name: Install R dependencies
41 run: Rscript -e "install.packages('RKorAPClient')"
42 - name: Cache R packages on Linux
Marc Kupietzfaa9f652022-12-22 11:00:55 +010043 uses: actions/cache@v3
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020044 with:
45 path: /usr/local/lib/R/site-library
Marc Kupietz3cb8eba2020-06-20 15:36:47 +020046 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020047 if: runner.os == 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020048 - name: Cache R packages
Marc Kupietzfaa9f652022-12-22 11:00:55 +010049 uses: actions/cache@v3
Marc Kupietz01f41602020-06-19 20:06:31 +020050 with:
51 path: ${{ env.R_LIBS_USER }}
Marc Kupietz3cb8eba2020-06-20 15:36:47 +020052 key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020053 if: runner.os != 'Linux'
Marc Kupietz01f41602020-06-19 20:06:31 +020054 - name: Install dependencies
55 run: |
56 python -m pip install --upgrade pip
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020057 pip install wheel
Marc Kupietzf84baac2024-01-26 09:20:00 +010058 - name: Install package on Mac and Linux
59 if: runner.os != 'Windows'
Marc Kupietz01f41602020-06-19 20:06:31 +020060 run: |
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020061 pip install .
Marc Kupietzf84baac2024-01-26 09:20:00 +010062 - name: Install package on Windows
63 if: runner.os == 'Windows'
64 run: |
65 pip install rpy2
66 pip install .
67 env:
68 R_HOME: "c:/R"
69 R_USER: "c:/R"
70 PATH: "c:/R/bin/x64;${{ env.PATH }}"
Marc Kupietz01f41602020-06-19 20:06:31 +020071 - name: Test with pytest on POSIX
72 if: runner.os != 'Windows'
73 run: |
74 export LD_LIBRARY_PATH=$(python -m rpy2.situation LD_LIBRARY_PATH):${LD_LIBRARY_PATH}
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020075 pip install pytest
76 pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
Marc Kupietz01f41602020-06-19 20:06:31 +020077 - name: Test with pytest on Windows
78 if: runner.os == 'Windows'
79 run: |
Marc Kupietz6fc4b2a2020-06-20 17:31:24 +020080 pip install pytest
81 pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml
82 env:
83 R_HOME: "c:/R"
84 R_USER: "c:/R"
Marc Kupietze8ca49f2020-06-24 14:45:10 +020085 PATH: "c:/R/bin/x64;${{ env.PATH }}"
Marc Kupietzcafdbb72020-06-27 18:54:46 +020086 - name: Build documentation un Linux
87 if: runner.os == 'Linux'
88 run: |
89 pip install pdoc3
90 pdoc KorAPClient --force --html -o build/doc
91 - name: Deploy documentation on Linux
92 if: runner.os == 'Linux'
93 uses: JamesIves/github-pages-deploy-action@releases/v3
94 with:
95 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96 BRANCH: gh-pages # The branch the action should deploy to.
97 FOLDER: build/doc # The folder the action should deploy.
98 TARGET_FOLDER: doc
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +020099 - name: Upload check results
100 if: failure()
Marc Kupietzfaa9f652022-12-22 11:00:55 +0100101 uses: actions/upload-artifact@v3
Marc Kupietz1e0d3cd2020-06-19 23:38:13 +0200102 with:
103 name: pytest-results-${{ matrix.python-version }}
104 path: junit/test-results-${{ matrix.python-version }}.xml
105