Skip to content

Commit aeea532

Browse files
aoliveramCopilotgvegayon
authored
Fix GitHub Actions Ubuntu runner libssl.so.3.1 error (#62)
* Initial plan * Replace deprecated arma::is_finite with std::isfinite Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com> * Fix GitHub Actions Ubuntu runner libssl issue - Update RSPM URLs from focal (20.04) to noble (24.04) - Explicitly install libssl-dev and libcurl4-openssl-dev - Update system_requirements() to target Ubuntu 24.04 - Fixes ubuntu-latest (release) check failure with libssl.so.3.1 Resolves #60 * Add missing system dependencies for igraph - Install libglpk-dev (required by igraph) - Install libgmp3-dev and libxml2-dev (additional dependencies) - Update local check script to include knitr - Fixes igraph.so loading error in GitHub Actions Related to #60 * Switch GitHub Actions to modern r-lib actions (#63) * Initial plan * Switch to modern r-lib actions and add scripts to .Rbuildignore Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
1 parent f656013 commit aeea532

4 files changed

Lines changed: 120 additions & 52 deletions

File tree

.Rbuildignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ makefile
4040
^\.github
4141
netdiffuseR\.Rcheck
4242
^\.devcontainer$
43-
^\.vscode$
43+
^\.vscode$
44+
^scripts$

.github/workflows/r.yml

Lines changed: 26 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
2-
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
on:
44
push:
5-
branches:
6-
- main
7-
- master
5+
branches: [main, master]
86
pull_request:
9-
branches:
10-
- main
11-
- master
7+
branches: [main, master]
128

139
name: R-CMD-check
1410

11+
env:
12+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
13+
1514
jobs:
1615
R-CMD-check:
1716
runs-on: ${{ matrix.config.os }}
@@ -22,62 +21,40 @@ jobs:
2221
fail-fast: false
2322
matrix:
2423
config:
24+
- {os: macOS-latest, r: 'release'}
2525
- {os: windows-latest, r: 'release'}
26-
- {os: macOS-latest, r: 'release'}
27-
- {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
28-
- {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
29-
- {os: ubuntu-latest, r: 'devel', valgrind: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
26+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
27+
- {os: ubuntu-latest, r: 'release'}
28+
- {os: ubuntu-latest, r: 'devel', valgrind: true, http-user-agent: 'release'}
3029

3130
env:
32-
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
33-
RSPM: ${{ matrix.config.rspm }}
3431
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
32+
R_KEEP_PKG_SOURCE: yes
3533

3634
steps:
3735
- uses: actions/checkout@v4
3836

37+
- uses: r-lib/actions/setup-pandoc@v2
38+
3939
- uses: r-lib/actions/setup-r@v2
4040
with:
4141
r-version: ${{ matrix.config.r }}
42+
http-user-agent: ${{ matrix.config.http-user-agent }}
43+
use-public-rspm: true
4244

43-
- uses: r-lib/actions/setup-pandoc@v2
44-
45-
- name: Query dependencies
46-
run: |
47-
install.packages('remotes')
48-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
49-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
50-
shell: Rscript {0}
51-
52-
- name: Restore R package cache
53-
if: runner.os != 'Windows'
54-
uses: actions/cache@v4
45+
- uses: r-lib/actions/setup-r-dependencies@v2
5546
with:
56-
path: ${{ env.R_LIBS_USER }}
57-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
58-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
59-
60-
- name: Install system dependencies
61-
if: runner.os == 'Linux'
62-
run: |
63-
while read -r cmd
64-
do
65-
eval sudo $cmd
66-
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
67-
- name: Install dependencies
68-
run: |
69-
remotes::install_deps(dependencies = TRUE)
70-
remotes::install_cran("rcmdcheck")
71-
shell: Rscript {0}
47+
extra-packages: any::rcmdcheck
48+
needs: check
7249

73-
- name: Check
50+
- uses: r-lib/actions/check-r-package@v2
7451
if: ${{ matrix.config.valgrind != true }}
75-
env:
76-
_R_CHECK_CRAN_INCOMING_REMOTE_: false
77-
run: |
78-
options(crayon.enabled = TRUE)
79-
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
80-
shell: Rscript {0}
52+
with:
53+
args: 'c("--no-manual", "--as-cran")'
54+
upload-snapshots: false
55+
upload-results: false
56+
check-dir: '"check"'
57+
error-on: '"error"'
8158

8259
- name: Setup valgrind
8360
if: ${{ matrix.config.valgrind == true }}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env bash
2+
#
3+
# check-github-actions-local.sh - Simulate GitHub Actions checks locally
4+
#
5+
# This script replicates the GitHub Actions workflow locally using Docker
6+
# to test changes before pushing to GitHub.
7+
#
8+
# Usage:
9+
# ./scripts/check-github-actions-local.sh [ubuntu|macos|windows|all]
10+
#
11+
# Requirements:
12+
# - Docker installed and running
13+
# - Run from repository root
14+
15+
set -e
16+
set -u
17+
18+
# Colors
19+
RED='\033[0;31m'
20+
GREEN='\033[0;32m'
21+
YELLOW='\033[1;33m'
22+
BLUE='\033[0;34m'
23+
NC='\033[0m'
24+
25+
# Configuration
26+
PLATFORM="${1:-ubuntu}"
27+
PACKAGE_NAME=$(awk '/^Package:/ {print $2}' DESCRIPTION)
28+
PACKAGE_VERSION=$(awk '/^Version:/ {print $2}' DESCRIPTION)
29+
30+
echo -e "${GREEN}========================================${NC}"
31+
echo -e "${GREEN}GitHub Actions Local Check${NC}"
32+
echo -e "${GREEN}========================================${NC}"
33+
echo "Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}"
34+
echo "Platform: ${PLATFORM}"
35+
echo ""
36+
37+
case "$PLATFORM" in
38+
ubuntu|linux)
39+
echo -e "${YELLOW}[1/3] Testing Ubuntu (r-release)...${NC}"
40+
41+
# Use R-hub Ubuntu container (simulates ubuntu-latest with R release)
42+
docker run --rm \
43+
-v "$(pwd):/workspace" \
44+
-w /workspace \
45+
ghcr.io/r-hub/containers/ubuntu-release:latest \
46+
bash -c "
47+
set -e
48+
echo '>>> Installing system dependencies...'
49+
apt-get update > /dev/null 2>&1
50+
apt-get install -y libssl-dev libcurl4-openssl-dev libglpk-dev libgmp3-dev libxml2-dev > /dev/null 2>&1
51+
52+
echo '>>> Installing R package dependencies...'
53+
Rscript -e \"install.packages(c('Rcpp', 'RcppArmadillo', 'sna', 'network', 'networkDynamic', 'Matrix', 'MASS', 'MatchIt', 'SparseM', 'boot', 'igraph', 'viridisLite', 'rcmdcheck', 'remotes', 'knitr'), repos='https://packagemanager.posit.co/cran/__linux__/noble/latest', quiet=TRUE)\"
54+
55+
echo '>>> Running R CMD check...'
56+
Rscript -e \"rcmdcheck::rcmdcheck(args = c('--no-manual', '--as-cran'), error_on = 'warning', check_dir = 'check')\"
57+
" && echo -e "${GREEN}✓ Ubuntu check passed${NC}" || echo -e "${RED}✗ Ubuntu check failed${NC}"
58+
;;
59+
60+
macos|mac)
61+
echo -e "${YELLOW}macOS checks require macOS host - skipped${NC}"
62+
echo "To test on macOS, run: R CMD build . && R CMD check --as-cran *.tar.gz"
63+
;;
64+
65+
windows|win)
66+
echo -e "${YELLOW}Windows checks require Windows host - skipped${NC}"
67+
echo "To test on Windows, use rhub or GitHub Actions"
68+
;;
69+
70+
all)
71+
echo -e "${BLUE}Running all available checks...${NC}"
72+
$0 ubuntu
73+
;;
74+
75+
*)
76+
echo -e "${RED}Unknown platform: $PLATFORM${NC}"
77+
echo "Usage: $0 [ubuntu|macos|windows|all]"
78+
exit 1
79+
;;
80+
esac
81+
82+
echo ""
83+
echo -e "${GREEN}========================================${NC}"
84+
echo -e "${GREEN}Local check completed!${NC}"
85+
echo -e "${GREEN}========================================${NC}"
86+
echo ""
87+
echo "Note: This simulates GitHub Actions but may have minor differences."
88+
echo "For exact GitHub Actions behavior, push to a branch and create a PR."
89+
echo ""

src/infection.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// [[Rcpp::depends(RcppArmadillo)]]
22
#include <RcppArmadillo.h>
3+
#include <cmath>
34
using namespace Rcpp;
45

56
// [[Rcpp::export]]
@@ -55,7 +56,7 @@ NumericVector infection_cpp(
5556
Rcpp::checkUserInterrupt();
5657

5758
// If NA (aka nan in Armadillo), then NA.
58-
if (!arma::is_finite(times(i))) {
59+
if (!std::isfinite(times(i))) {
5960
infect.at(i) = NA_REAL;
6061
continue;
6162
}
@@ -159,7 +160,7 @@ NumericVector susceptibility_cpp(
159160
Rcpp::checkUserInterrupt();
160161

161162
// If NA (aka nan in Armadillo), then NA.
162-
if (!arma::is_finite(times(i))) {
163+
if (!std::isfinite(times(i))) {
163164
suscep.at(i) = NA_REAL;
164165
continue;
165166
}

0 commit comments

Comments
 (0)