Skip to content

Commit 2c36c85

Browse files
Fixed bugs in GitHub action R-CMD-check
- by adding JAGS installation to action - by installing libgsl-dev and libgsl27 on Linux
1 parent b71886a commit 2c36c85

File tree

2 files changed

+107
-3
lines changed

2 files changed

+107
-3
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
8+
name: R-CMD-check.yaml
9+
10+
permissions: read-all
11+
12+
jobs:
13+
R-CMD-check:
14+
runs-on: ${{ matrix.config.os }}
15+
16+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
config:
22+
- {os: macOS-latest, r: 'release'}
23+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
24+
- {os: ubuntu-latest, r: 'release'}
25+
- {os: ubuntu-latest, r: 'oldrel-1'}
26+
- {os: windows-latest, r: 'release'}
27+
28+
env:
29+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
30+
R_KEEP_PKG_SOURCE: yes
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Install system dependencies (Ubuntu)
36+
if: runner.os == 'Linux'
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y libgsl-dev libgsl27
40+
41+
- uses: r-lib/actions/setup-pandoc@v2
42+
43+
- uses: r-lib/actions/setup-r@v2
44+
with:
45+
r-version: ${{ matrix.config.r }}
46+
http-user-agent: ${{ matrix.config.http-user-agent }}
47+
use-public-rspm: true
48+
49+
- name: Install JAGS (macOS)
50+
if: runner.os == 'macOS'
51+
run: |
52+
brew install jags
53+
echo "JAGS_HOME=$(brew --prefix jags)" >> $GITHUB_ENV
54+
55+
- name: Install JAGS (Windows)
56+
if: runner.os == 'Windows'
57+
run: |
58+
# Create a temporary directory for the installer
59+
$tempDir = Join-Path $env:RUNNER_TEMP "jags-installer"
60+
New-Item -ItemType Directory -Path $tempDir -Force
61+
62+
# Download JAGS to the temporary directory
63+
$installerPath = Join-Path $tempDir "JAGS-4.3.1.exe"
64+
curl -LO https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/JAGS-4.3.1.exe
65+
Move-Item -Path "JAGS-4.3.1.exe" -Destination $installerPath
66+
67+
# Install JAGS
68+
Start-Process -FilePath $installerPath -ArgumentList "/S" -NoNewWindow -Wait
69+
70+
# Set environment variable
71+
echo "JAGS_HOME=C:/Program Files/JAGS/JAGS-4.3.1" >> $env:GITHUB_ENV
72+
73+
# Clean up the installer
74+
Remove-Item -Path $tempDir -Recurse -Force
75+
shell: pwsh
76+
77+
- name: Set up JAGS environment (macOS)
78+
if: runner.os == 'macOS'
79+
run: |
80+
echo "JAGS_LIB=$JAGS_HOME/lib" >> $GITHUB_ENV
81+
echo "PKG_CONFIG_PATH=$JAGS_HOME/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
82+
echo "LDFLAGS=-L$JAGS_HOME/lib" >> $GITHUB_ENV
83+
echo "CPPFLAGS=-I$JAGS_HOME/include" >> $GITHUB_ENV
84+
echo "LD_LIBRARY_PATH=$JAGS_HOME/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
85+
echo "DYLD_LIBRARY_PATH=$JAGS_HOME/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
86+
# Create symbolic links for JAGS modules
87+
sudo mkdir -p /usr/local/lib/JAGS/modules-4
88+
for module in basemod bugs terminal; do
89+
sudo ln -sf "$JAGS_HOME/lib/JAGS/modules-4/${module}.so" "/usr/local/lib/JAGS/modules-4/${module}.so"
90+
done
91+
92+
- name: Set up JAGS environment (Windows)
93+
if: runner.os == 'Windows'
94+
run: |
95+
echo "PATH=C:/Program Files/JAGS/JAGS-4.3.1/bin;${env:PATH}" >> $env:GITHUB_ENV
96+
shell: pwsh
97+
98+
- uses: r-lib/actions/setup-r-dependencies@v2
99+
with:
100+
extra-packages: any::rcmdcheck
101+
needs: check
102+
103+
- uses: r-lib/actions/check-r-package@v2
104+
with:
105+
upload-snapshots: true
106+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# handwriterRF
22

33
<!-- badges: start -->
4-
[![R-CMD-check MacOS](https://github.com/CSAFE-ISU/handwriterRF/actions/workflows/R-CMD-check-macos.yaml/badge.svg)](https://github.com/CSAFE-ISU/handwriterRF/actions/workflows/R-CMD-check-macos.yaml)
5-
[![R-CMD-check Ubuntu](https://github.com/CSAFE-ISU/handwriterRF/actions/workflows/R-CMD-check-ubuntu.yaml/badge.svg)](https://github.com/CSAFE-ISU/handwriterRF/actions/workflows/R-CMD-check-ubuntu.yaml)
6-
[![R-CMD-check Windows](https://github.com/CSAFE-ISU/handwriterRF/actions/workflows/R-CMD-check-windows.yaml/badge.svg)](https://github.com/CSAFE-ISU/handwriterRF/actions/workflows/R-CMD-check-windows.yaml)
4+
[![R-CMD-check](https://github.com/CSAFE-ISU/handwriterRF/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/CSAFE-ISU/handwriterRF/actions/workflows/R-CMD-check.yaml)
75
[![Codecov test coverage](https://codecov.io/gh/CSAFE-ISU/handwriterRF/graph/badge.svg)](https://app.codecov.io/gh/CSAFE-ISU/handwriterRF)
86
<!-- badges: end -->
97

0 commit comments

Comments
 (0)