Add Make targets for easier development/testing; update README
This commit is contained in:
parent
1de359f3e6
commit
974cefff66
2 changed files with 38 additions and 17 deletions
20
Makefile
20
Makefile
|
|
@ -39,6 +39,26 @@ rebuild-all: deps fetch-serverless-custom-file
|
|||
serverless-deploy.%: deps fetch-serverless-custom-file
|
||||
$(SLS_BINARY) deploy --stage $*
|
||||
|
||||
define GEN_TARGETS
|
||||
docker-build-$(platform):
|
||||
@cd builder && docker-compose build $(platform)
|
||||
|
||||
build-r-$(platform):
|
||||
@cd builder && R_VERSION=$(R_VERSION) docker-compose up $(platform)
|
||||
|
||||
test-r-$(platform):
|
||||
@cd test && R_VERSION=$(R_VERSION) docker-compose up $(platform)
|
||||
|
||||
bash-$(platform):
|
||||
docker run -it --rm --entrypoint /bin/bash -v $(CURDIR):/r-builds r-builds:$(platform)
|
||||
|
||||
.PHONY: docker-build-$(platform) build-r-$(platform) test-r-$(platform) bash-$(platform)
|
||||
endef
|
||||
|
||||
$(foreach platform,$(PLATFORMS), \
|
||||
$(eval $(GEN_TARGETS)) \
|
||||
)
|
||||
|
||||
# Helper for launching a bash session on a docker image of your choice. Defaults
|
||||
# to "ubuntu:xenial".
|
||||
TARGET_IMAGE?=ubuntu:xenial
|
||||
|
|
|
|||
35
README.md
35
README.md
|
|
@ -244,33 +244,34 @@ serverless invoke stepf -n rBuilds -d '{"force": true, "versions": ["3.6.3", "4.
|
|||
|
||||
## Testing
|
||||
|
||||
To test the R builds locally, you can build the images:
|
||||
To test the R builds locally, you can use the `build-r-$PLATFORM` and `test-r-$PLATFORM`
|
||||
targets to build R and run the tests. The tests use the quick install script to install R,
|
||||
using a locally built R if present, or otherwise a build from the CDN.
|
||||
|
||||
```bash
|
||||
# Build images for all platforms
|
||||
make docker-build
|
||||
# Build R 4.1.3 for Ubuntu 22
|
||||
R_VERSION=4.1.3 make build-r-ubuntu-2204
|
||||
|
||||
# Or build the image for a single platform
|
||||
(cd builder && docker-compose build ubuntu-2004)
|
||||
# Test R 4.1.3 for Ubuntu 22
|
||||
R_VERSION=4.1.3 make test-r-ubuntu-2204
|
||||
```
|
||||
|
||||
Then run the build script:
|
||||
Alternatively, you can build an image using the `docker-build-$PLATFORM`
|
||||
target, launch a bash session within a container using the `bash-$PLATFORM` target,
|
||||
and interactively run the build script:
|
||||
|
||||
```bash
|
||||
# Build R for all platforms
|
||||
R_VERSION=4.0.5 make docker-build-r
|
||||
# Build the image for Ubuntu 22
|
||||
make docker-build-ubuntu-2204
|
||||
|
||||
# Build R for a single platform
|
||||
(cd builder && R_VERSION=4.0.5 docker-compose up ubuntu-2004)
|
||||
# Launch a bash session for Ubuntu 22
|
||||
make bash-ubuntu-2204
|
||||
|
||||
# Alternatively, run the build script from within a container
|
||||
docker run -it --rm --entrypoint "/bin/bash" r-builds:ubuntu-2004
|
||||
# Build R 4.1.3
|
||||
R_VERSION=4.1.3 ./build.sh
|
||||
|
||||
# Build R 4.0.5
|
||||
R_VERSION=4.0.5 ./build.sh
|
||||
|
||||
# Build R devel
|
||||
R_VERSION=devel ./build.sh
|
||||
# Build R devel with parallel execution to speed up the build
|
||||
MAKEFLAGS=-j4 R_VERSION=devel ./build.sh
|
||||
|
||||
# Build a prerelease version of R (e.g., alpha or beta)
|
||||
R_VERSION=rc R_TARBALL_URL=https://cran.r-project.org/src/base-prerelease/R-latest.tar.gz ./build.sh
|
||||
|
|
|
|||
Loading…
Reference in a new issue