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
|
serverless-deploy.%: deps fetch-serverless-custom-file
|
||||||
$(SLS_BINARY) deploy --stage $*
|
$(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
|
# Helper for launching a bash session on a docker image of your choice. Defaults
|
||||||
# to "ubuntu:xenial".
|
# to "ubuntu:xenial".
|
||||||
TARGET_IMAGE?=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
|
## 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
|
```bash
|
||||||
# Build images for all platforms
|
# Build R 4.1.3 for Ubuntu 22
|
||||||
make docker-build
|
R_VERSION=4.1.3 make build-r-ubuntu-2204
|
||||||
|
|
||||||
# Or build the image for a single platform
|
# Test R 4.1.3 for Ubuntu 22
|
||||||
(cd builder && docker-compose build ubuntu-2004)
|
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
|
```bash
|
||||||
# Build R for all platforms
|
# Build the image for Ubuntu 22
|
||||||
R_VERSION=4.0.5 make docker-build-r
|
make docker-build-ubuntu-2204
|
||||||
|
|
||||||
# Build R for a single platform
|
# Launch a bash session for Ubuntu 22
|
||||||
(cd builder && R_VERSION=4.0.5 docker-compose up ubuntu-2004)
|
make bash-ubuntu-2204
|
||||||
|
|
||||||
# Alternatively, run the build script from within a container
|
# Build R 4.1.3
|
||||||
docker run -it --rm --entrypoint "/bin/bash" r-builds:ubuntu-2004
|
R_VERSION=4.1.3 ./build.sh
|
||||||
|
|
||||||
# Build R 4.0.5
|
# Build R devel with parallel execution to speed up the build
|
||||||
R_VERSION=4.0.5 ./build.sh
|
MAKEFLAGS=-j4 R_VERSION=devel ./build.sh
|
||||||
|
|
||||||
# Build R devel
|
|
||||||
R_VERSION=devel ./build.sh
|
|
||||||
|
|
||||||
# Build a prerelease version of R (e.g., alpha or beta)
|
# 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
|
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