R packages correct the installation #268
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: Unit Tests | |
| on: | |
| push: | |
| branches-ignore: | |
| - 'test_deploy' | |
| pull_request: | |
| branches: | |
| - '*' | |
| concurrency: | |
| group: ci-tests-${{ github.ref }}-1 | |
| # main should run through entire queue of commits for debugging | |
| cancel-in-progress: ${{ github.ref_name != 'main'}} | |
| jobs: | |
| run_tester: | |
| runs-on: ${{ matrix.config.os }} | |
| if: "!contains(github.event.head_commit.message, 'ci skip')" | |
| env: | |
| RENV_PATHS_ROOT: ~/.local/share/renv | |
| R_LIBS_USER: /home/runner/work/_temp/Library | |
| R_PROFILE_USER: /home/runner/work/_temp/.Rprofile | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - {name: '3.13', os: ubuntu-latest, python: '3.13', r: 'release'} | |
| - {name: '3.12', os: ubuntu-latest, python: '3.12', r: 'release'} | |
| - {name: '3.11', os: ubuntu-latest, python: '3.11', r: 'release'} | |
| - {name: '3.10', os: ubuntu-latest, python: '3.10', r: 'release'} | |
| - {name: '3.9', os: ubuntu-latest, python: '3.9', r: 'release'} | |
| steps: | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install system dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y \ | |
| pandoc gfortran libblas-dev liblapack-dev libedit-dev llvm-dev \ | |
| libcurl4-openssl-dev ffmpeg libhdf5-dev libfribidi-dev libharfbuzz-dev \ | |
| libxml2-dev libssl-dev \ | |
| libfontconfig1-dev libfreetype6-dev | |
| - name: Install pkg-config | |
| run: sudo apt-get update && sudo apt-get install -y pkg-config | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.config.python }} | |
| - name: Set up R | |
| id: setup-r | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: ${{ matrix.config.r }} | |
| - name: Set up Pandoc | |
| uses: r-lib/actions/setup-pandoc@v2 | |
| - name: Cache Python packages | |
| uses: pat-s/always-upload-cache@v2 | |
| with: | |
| path: ${{ env.pythonLocation }} | |
| key: ${{runner.os}}-pip-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} | |
| restore-keys: ${{runner.os}}-pip-${{ env.pythonLocation }}- | |
| - name: Cache R packages | |
| uses: pat-s/always-upload-cache@v2 | |
| if: startsWith(runner.os, 'Linux') | |
| with: | |
| path: ${{ env.R_LIBS_USER }} | |
| key: ${{ runner.os }}-R-${{ steps.setup-r.outputs.installed-r-version }}-${{ hashFiles('DESCRIPTION') }}-v2 | |
| restore-keys: | | |
| ${{ runner.os }}-R-${{ steps.setup-r.outputs.installed-r-version }}-v2 | |
| - name: Install python tools | |
| run: | | |
| # Ensure pip is properly installed | |
| python -m ensurepip --upgrade || true | |
| python -m pip install --upgrade pip | |
| pip install --upgrade wheel setuptools | |
| - name: Set up rpy2 | |
| run: | | |
| pip install rpy2 | |
| echo "LD_LIBRARY_PATH=$(python -m rpy2.situation LD_LIBRARY_PATH):${LD_LIBRARY_PATH}" >> $GITHUB_ENV | |
| - name: Install core R packages | |
| run: | | |
| install.packages(c("remotes", "devtools", "BiocManager"), repos = "https://cloud.r-project.org/") | |
| shell: Rscript {0} | |
| - name: Install Bioconductor packages | |
| run: | | |
| BiocManager::install(c("splatter", "slingshot"), ask = FALSE, update = FALSE) | |
| shell: Rscript {0} | |
| - name: Install GitHub packages | |
| run: | | |
| remotes::install_github(c("dynverse/dyngen", "dynverse/dynwrap"), upgrade = "never") | |
| shell: Rscript {0} | |
| - name: Verify R package installation | |
| run: | | |
| packages <- c("splatter", "slingshot", "dyngen", "dynwrap") | |
| for (pkg in packages) { | |
| if (!requireNamespace(pkg, quietly = TRUE)) { | |
| stop(paste("Package", pkg, "failed to install")) | |
| } | |
| cat("✓ Package", pkg, "installed successfully\n") | |
| } | |
| shell: Rscript {0} | |
| - name: Install scprep | |
| id: install-python-packages | |
| run: | | |
| python -m pip install --upgrade .[test] | |
| python -c "import scprep" | |
| - name: Run tests | |
| run: nose2 -vvv | |
| - name: Coveralls | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COVERALLS_SERVICE_NAME: github | |
| run: | | |
| coveralls | |
| - name: Upload check results on fail | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.config.name }}_results | |
| path: check |