-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (141 loc) · 5.91 KB
/
Copy pathcopilot-setup-steps.yml
File metadata and controls
158 lines (141 loc) · 5.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# GitHub Copilot Setup Steps for serodynamics
#
# This workflow configures the GitHub Copilot coding agent's environment
# by preinstalling R, JAGS, and all required dependencies.
#
# See: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
# For detailed setup instructions, see .github/copilot-instructions.md
#
# This workflow aligns with the setup requirements documented in .github/copilot-instructions.md:
# - R version >= 4.1.0 (as specified in DESCRIPTION)
# - JAGS 4.3.1 system library and R interface
# - All package dependencies (Imports, Suggests, and development needs)
name: "Copilot Setup Steps"
# Automatically run the setup steps when they are changed to allow for easy validation,
# and allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest
# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
contents: read
# Timeout after 55 minutes (max is 59 for copilot-setup-steps)
timeout-minutes: 55
steps:
# Checkout code - Copilot will do this automatically if we don't,
# but we need it to install dependencies from DESCRIPTION
- name: Checkout code
uses: actions/checkout@v4
# Install system dependencies required for R packages
# See .github/copilot-instructions.md "Verify Development Environment" section
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libfontconfig1-dev \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev
# Install JAGS (Just Another Gibbs Sampler) - REQUIRED for this package
# Version 4.3.1 as documented in .github/copilot-instructions.md
- name: Install JAGS
run: |
sudo apt-get install -y jags
echo "JAGS installed successfully"
# Set up pandoc for documentation
- name: Set up Pandoc
uses: r-lib/actions/setup-pandoc@v2
# Set up R using the standard GitHub Actions setup
# R version >= 4.1.0 required (see DESCRIPTION and .github/copilot-instructions.md)
- name: Set up R
uses: r-lib/actions/setup-r@HEAD
with:
r-version: 'release'
use-public-rspm: true
# Install R dependencies with caching for faster subsequent runs
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@HEAD
with:
extra-packages: |
any::devtools
any::rcmdcheck
any::lintr
any::spelling
any::rmarkdown
needs: check
# Install rjags from source to ensure proper linking with JAGS
# See .github/copilot-instructions.md "JAGS Installation" section
- name: Install rjags
run: |
install.packages("rjags",
repos = "https://cloud.r-project.org",
type = "source",
verbose = TRUE)
withr::local_options(warn = 2)
library(rjags)
library(runjags)
runjags::findjags()
runjags::testjags()
shell: Rscript {0}
# Verify JAGS installation
# See .github/copilot-instructions.md "JAGS Installation" section for details
- name: Verify JAGS installation
run: |
echo "=== Verifying JAGS Installation ==="
echo "System JAGS command:"
which jags || echo "Warning: jags command not found in PATH"
echo ""
echo "R JAGS interface packages:"
Rscript -e 'cat("rjags version:", as.character(packageVersion("rjags")), "\n")'
Rscript -e 'cat("runjags version:", as.character(packageVersion("runjags")), "\n")'
echo ""
echo "JAGS location (from runjags):"
Rscript -e 'print(runjags::findjags())'
echo ""
echo "Running JAGS test:"
Rscript -e 'runjags::testjags()'
# Verify R environment is properly configured
# See .github/copilot-instructions.md "Verify Development Environment" section
- name: Verify development environment
run: |
echo "=== R Development Environment Status ==="
Rscript -e '
cat("R version:", R.version.string, "\n\n")
# Check R version meets minimum requirement (>= 4.1.0)
r_version <- paste(R.version$major, R.version$minor, sep = ".")
cat("Checking R version >= 4.1.0... ")
if (getRversion() >= "4.1.0") {
cat("PASSED (", r_version, ")\n\n", sep = "")
} else {
cat("FAILED (", r_version, ")\n\n", sep = "")
stop("R version must be >= 4.1.0")
}
# Display key installed packages
cat("Key installed packages:\n")
key_packages <- c("devtools", "rjags", "runjags", "rcmdcheck", "lintr", "spelling", "testthat")
for (pkg in key_packages) {
if (requireNamespace(pkg, quietly = TRUE)) {
cat(" -", pkg, ":", as.character(packageVersion(pkg)), "\n")
} else {
cat(" -", pkg, ": NOT INSTALLED\n")
}
}
cat("\nTotal packages installed:", nrow(installed.packages()), "\n")
cat("\nDevelopment environment setup complete!\n")
'