Skip to content

Commit dc7eaba

Browse files
committed
update workflow
1 parent 179f6e4 commit dc7eaba

1 file changed

Lines changed: 31 additions & 37 deletions

File tree

.github/workflows/unittest.yml

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,60 +18,54 @@ jobs:
1818
matrix:
1919
python-version: ["3.9", "3.10", "3.11"]
2020
steps:
21-
- uses: actions/checkout@v4
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
2224
- name: Set up R 4.4.2
2325
uses: r-lib/actions/setup-r@v2
2426
with:
2527
r-version: '4.4.2'
26-
- name: Install R development packages
28+
29+
- name: Install R system dependencies
2730
run: |
2831
sudo apt-get update
29-
sudo apt-get install -y \
30-
r-base-dev \
31-
libcurl4-openssl-dev \
32-
libssl-dev \
33-
libxml2-dev \
34-
libgit2-dev \
35-
libmagick++-dev
36-
- name: Setup R packages using docker-compatible script
32+
sudo apt-get install -y r-base-dev libcurl4-openssl-dev libssl-dev libxml2-dev libgit2-dev libmagick++-dev
33+
- name: Setup R packages with renv
3734
env:
3835
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3936
R_REMOTES_NO_ERRORS_FROM_WARNINGS: "true"
37+
run: Rscript setup_docker_compatible_renv.R
38+
- name: Copy renv packages to global library
4039
run: |
41-
R -e "install.packages('remotes', repos='https://cran.r-project.org')"
42-
chmod +x setup_docker_compatible_renv.R
43-
Rscript setup_docker_compatible_renv.R
44-
- name: Verify R packages installation
45-
run: |
46-
R -e "
47-
essential_packages <- c('BiocManager', 'rjson', 'GSVA', 'dpGMM', 'AUCell')
48-
cat('Verifying R packages installation:\\n')
49-
all_ok <- TRUE
50-
for (pkg in essential_packages) {
51-
if (require(pkg, quietly = TRUE, character.only = TRUE)) {
52-
cat(sprintf(' ✓ %s\\n', pkg))
53-
} else {
54-
cat(sprintf(' ✗ %s (MISSING)\\n', pkg))
55-
all_ok <- FALSE
56-
}
57-
}
58-
if (!all_ok) {
59-
cat('Some packages are missing, this will cause test failures\\n')
60-
quit(status = 1)
40+
R --slave -e "
41+
renv_lib <- renv::paths\$library()
42+
global_lib <- R.home('library')
43+
packages <- list.dirs(renv_lib, full.names = FALSE, recursive = FALSE)
44+
packages <- packages[packages != '']
45+
cat('Copying', length(packages), 'packages...\n')
46+
for (pkg in packages) {
47+
system(paste('cp -rf', shQuote(file.path(renv_lib, pkg)), shQuote(global_lib)))
6148
}
62-
cat('All essential R packages verified successfully\\n')
6349
"
64-
- name: Install poetry
50+
- name: Verify essential packages
51+
run: |
52+
R --slave -e "
53+
essential <- c('BiocManager', 'rjson', 'GSVA', 'dpGMM', 'AUCell')
54+
missing <- essential[!sapply(essential, require, quietly=TRUE, character.only=TRUE)]
55+
if (length(missing) > 0) { cat('Missing:', paste(missing, collapse=', '), '\n'); quit(status=1) }
56+
cat('✓ All packages verified\n')
57+
"
58+
- name: Install Poetry
6559
run: pipx install poetry
6660

6761
- name: Set up Python ${{ matrix.python-version }}
6862
uses: actions/setup-python@v5
6963
with:
7064
python-version: ${{ matrix.python-version }}
7165
cache: 'poetry'
72-
- name: Install dependencies
73-
run: |
74-
poetry install --with dev
75-
poetry build
76-
- name: Running the tests with pytest
66+
67+
- name: Install Python dependencies
68+
run: poetry install --with dev
69+
70+
- name: Run Python tests
7771
run: poetry run pytest

0 commit comments

Comments
 (0)