@@ -27,6 +27,8 @@ curl -Ls https://github.com/r-lib/rig/releases/download/latest/\
2727rig-linux-latest.tar.gz | sudo tar xz -C /usr/local
2828# Install latest R version
2929sudo rig add release
30+ # Ensure R and tools are in PATH
31+ sudo rig system make-links
3032```
3133
3234Set up PostgreSQL for testing:
@@ -44,8 +46,7 @@ sudo -u postgres createdb testdb
4446Install essential R packages using pak:
4547
4648``` bash
47- R -e " install.packages('pak', repos = 'https://r-lib.github.io/p/pak/stable/')"
48- R -e " pak::pak(c('DBI', 'testthat', 'devtools'))"
49+ R -q -e ' pak::pak(); pak::pak(c("devtools", "r-lib/roxygen2", "r-lib/pkgdown"))'
4950```
5051
5152### Environment Variables for Testing
@@ -72,8 +73,17 @@ R CMD build .
7273Install the built package:
7374
7475``` bash
75- sudo R CMD INSTALL RPostgres_* .tar.gz
76- # Takes ~25 seconds with C++ compilation. NEVER CANCEL. Set timeout to 60+ seconds.
76+ UserNM=true R CMD INSTALL .
77+ # Takes ~30 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
78+ ```
79+
80+ Run lightweight tests (for quick iteration):
81+
82+ ``` bash
83+ # Must set PostgreSQL environment variables first!
84+ export PGHOST=localhost PGPORT=5432 PGUSER=runner PGPASSWORD=test123 PGDATABASE=testdb
85+ R -q -e ' testthat::test_local()'
86+ # Takes ~30 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
7787```
7888
7989Run comprehensive package check:
@@ -88,7 +98,7 @@ R CMD check RPostgres_*.tar.gz --no-manual
8898Update documentation (requires devtools):
8999
90100``` bash
91- R -e " library( devtools); document()"
101+ R -q -e ' devtools:: document()'
92102# Takes ~20 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
93103```
94104
@@ -111,9 +121,11 @@ dbDisconnect(con)
111121### Required Testing Before Committing
112122
1131231 . ALWAYS build and install the package successfully
114- 2 . ALWAYS run R CMD check with PostgreSQL environment variables set
115- 3 . ALWAYS test basic database connectivity and operations
116- 4 . Run ` devtools::document() ` if you modified any roxygen comments in R files
124+ 2 . ALWAYS run ` testthat::test_local() ` for quick iteration testing
125+ 3 . ALWAYS run R CMD check with PostgreSQL environment variables set for
126+ comprehensive testing
127+ 4 . ALWAYS test basic database connectivity and operations
128+ 5 . Run ` devtools::document() ` if you modified any roxygen comments in R files
117129
118130## Build System Details
119131
0 commit comments