update Client to v 1.2.1, add fetchAnnotations() function #187
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PythonKorAPClient CI unit test | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| max-parallel: 6 | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.11', '3.13'] | |
| r-version: [release] | |
| os: [macos-15, ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' # caching pip dependencies | |
| - name: Set up R ${{ matrix.r-version }} | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: ${{ matrix.r-version }} | |
| use-public-rspm: true | |
| - name: Set env commands (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| echo "VENV_ACTIVATE=source pyenv_base/bin/activate" >> $GITHUB_ENV | |
| echo "LD_LIBRARY_PATH=$(dirname $(find / -name libR.so 2> /dev/null)):${LD_LIBRARY_PATH}" >> $GITHUB_ENV | |
| echo "R_LIBRARY=export LD_LIBRARY_PATH=$(python -m rpy2.situation LD_LIBRARY_PATH):${LD_LIBRARY_PATH}" >> $GITHUB_ENV | |
| - name: Set env commands (MacOS) | |
| if: "startsWith(matrix.os, 'macos')" | |
| run: | | |
| echo "VENV_ACTIVATE=source pyenv_base/bin/activate" >> $GITHUB_ENV | |
| echo "R_LIBRARY=$(find /Library -name libR.dylib 2> /dev/null | head -1)" >> $GITHUB_ENV | |
| echo "LD_LIBRARY_PATH=$(dirname $(find /Library -name libR.dylib 2> /dev/null | head -1)):${LD_LIBRARY_PATH}" >> $GITHUB_ENV | |
| - name: Set virtualenv activation command (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| shell: bash | |
| run: | | |
| echo "VENV_ACTIVATE=pyenv_base\Scripts\activate" >> $GITHUB_ENV | |
| echo "R_LIBRARY=''" >> $GITHUB_ENV | |
| - name: Patch GHA issue with macos - Missing C library | |
| if: startsWith(matrix.os, 'macos') | |
| shell: bash | |
| run: | | |
| LIB_ARCHIVES=(\ | |
| libdeflate-1.23-darwin.20-arm64.tar.xz \ | |
| zstd-1.5.5-darwin.20-arm64.tar.xz \ | |
| ) | |
| for name in "${LIB_ARCHIVES[@]}" | |
| do | |
| curl -LO https://mac.r-project.org/bin/darwin20/arm64/"${name}" | |
| sudo tar xJf "${name}" -C / | |
| done | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install setuptools build | |
| - name: Set up package maintainers R on Linux | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y libglpk-dev libsodium-dev libxml2-dev libcurl4-openssl-dev | |
| sudo mkdir -p /usr/local/lib/R/site-library | |
| sudo chown $(whoami) /usr/local/lib/R/site-library | |
| export R_LIBS_USER=/usr/local/lib/R/site-library | |
| if: runner.os == 'Linux' | |
| - name: Install R dependencies | |
| run: | | |
| Rscript -e "install.packages('pak')" | |
| Rscript -e "pak::pak('RKorAPClient')" | |
| - name: Cache R packages on Linux | |
| uses: actions/cache@v3 | |
| with: | |
| path: /usr/local/lib/R/site-library | |
| key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }} | |
| if: runner.os == 'Linux' | |
| - name: Cache R packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ env.R_LIBS_USER }} | |
| key: ${{ runner.os }}-r-${{ matrix.config.r-version }}-${{ hashFiles('DESCRIPTION') }} | |
| if: runner.os != 'Linux' | |
| - name: Install package | |
| if: runner.os != 'Windows' | |
| run: | | |
| pip install rpy2 | |
| pip install . | |
| - name: Install package on Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| pip install rpy2 | |
| pip install . | |
| env: | |
| R_HOME: "c:/R" | |
| R_USER: "c:/R" | |
| PATH: "c:/R/bin;c:/R/bin/x64;${{ env.PATH }}" | |
| - name: Test with pytest on POSIX | |
| if: runner.os != 'Windows' | |
| run: | | |
| export LD_LIBRARY_PATH=$(dirname $R_LIBRARY):${LD_LIBRARY_PATH} | |
| echo $LD_LIBRARY_PATH | |
| python -m ensurepip --upgrade | |
| python -m pip install pytest | |
| pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml | |
| - name: Test with pytest on Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| pip install pytest | |
| pytest KorAPClient/tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml | |
| env: | |
| R_HOME: "c:/R" | |
| R_USER: "c:/R" | |
| PATH: "c:/R/bin/x64;${{ env.PATH }}" | |
| - name: Build documentation un Linux | |
| if: runner.os == 'Linux' | |
| run: | | |
| pip install pdoc3 | |
| pdoc KorAPClient --force --html -o build/doc | |
| - name: Deploy documentation on Linux | |
| if: runner.os == 'Linux' | |
| uses: JamesIves/github-pages-deploy-action@releases/v4 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| BRANCH: gh-pages # The branch the action should deploy to. | |
| FOLDER: build/doc # The folder the action should deploy. | |
| TARGET_FOLDER: doc | |
| - name: Upload check results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pytest-results-${{ matrix.python-version }} | |
| path: junit/test-results-${{ matrix.python-version }}.xml | |