-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
106 lines (80 loc) · 3.57 KB
/
Makefile
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
MAKEFILE=Makefile
VERSION=1.4.12
.PHONY: help
#------------------------------------------------------------------
# Targets
#------------------------------------------------------------------
help:
@echo ""
@echo "- Available targets:"
@echo "- Info: make check VERSION=1.4.8 "
@perl -ne 'if( /^(\w+):/){print "\t",$$1,"\n"}' $(MAKEFILE)
@echo ""
@echo ""
clean:
@rm -f src/*.o src/*.so; rm -f scigenex.Rcheck/dbfmcl/libs/dbfmcl.so; rm -rf ./dbfmcl.Rcheck; rm -rf ..Rcheck, rm -rf ./..Rcheck/
@rm -rf /tmp/dbfmcl; rm -rf *dbf_out.txt; rm -rf *mcl_out.txt rm -rf ./scigenex.Rcheck
@rm -f tests/testthat/Rplot*; rm -rf tests/testthat/_snaps
check: clean
@rm -rf /tmp/scigenex; mkdir -p /tmp/scigenex; cp -r ./* /tmp/scigenex; cd /tmp/scigenex; \
rm -f src/*.o src/*.so; rm -f scigenex.Rcheck/dbfmcl/libs/dbfmcl.so; \
cd ..; R CMD build scigenex; R CMD check scigenex_$(VERSION).tar.gz
run_example:
@echo "devtools::run_examples(pkg = '.')" | R --slave
checkfast: clean
@rm -rf /tmp/scigenex; mkdir -p /tmp/scigenex; cp -r ./* /tmp/scigenex; cd /tmp/scigenex; \
rm -f src/*.o src/*.so; rm -f scigenex.Rcheck/dbfmcl/libs/dbfmcl.so; \
R CMD check --no-install .
doc:
@echo ">>> Creating a package documentation"
@echo "library(roxygen2); roxygen2::roxygenise()" | R --slave
install:
@echo ">>> Installing..."
@rm -f src/*.o src/*.so
@R CMD INSTALL .
test:
@echo ">>> Testing package"
@rm -rf `ls tests/testthat/| grep -v \R$$`
@echo "devtools::test()" | R --slave
test_by_file:
@echo 'library(scigenex); for(i in dir("./tests/testthat/", pattern = ".R$$")){devtools::test_active_file(file.path("./tests/testthat/", i))}' | R --slave
coverage:
@echo "Checking coverage"
@echo "usethis::use_github_action('test-coverage'); cov <- covr::package_coverage(); print(as.data.frame(cov))" | R --slave
codecov:
@echo "Uploading coverage (https://app.codecov.io/github/dputhier/scigenex)"
@echo "library(covr); codecov(token ='8f08768a-0629-4ed0-91b9-bdd9f7019916')" | R --slave
#------------------------------------------------------------------
# Creating a release
#------------------------------------------------------------------
__check_defined_VER:
@[ "$(VERSION)" ] || ( echo ">> VER is not set"; exit 1 )
release: __check_defined_VER
@ echo "#-----------------------------------------------#"
@ echo "# Starting the release $(VERSION) #"
@ echo "#-----------------------------------------------#"
release_bump: release
@ echo "#-----------------------------------------------#"
@ echo "# Bumping the program version #"
@ echo "#-----------------------------------------------#"
@ git checkout ./DESCRIPTION
@ git checkout ./Makefile
@ R CMD INSTALL .
@ cat ./DESCRIPTION | perl -npe "s/Version: .*/Version: $(VERSION)/" > /tmp/scigenex.bump
@ mv /tmp/scigenex.bump ./DESCRIPTION
@ cat ./Makefile | perl -npe 's/^VERSION=.*/VERSION=$(VERSION)/' > /tmp/scigenex.bump
@ mv /tmp/scigenex.bump ./Makefile
@ echo "Version was bump to $(VERSION)"
@ make install
@ git commit -m 'Bumped version $(VERSION)'
readme:
@ echo "- Rebuilting README.md from README.Rmd"
@ echo "devtools::build_readme()" | R --slave
doc_html:
@ echo "#-----------------------------------------------#"
@ echo "# Building doc #"
@ echo "#-----------------------------------------------#"
@ echo "Sys.setenv(RSTUDIO_PANDOC='/Applications/RStudio.app/Contents/Resources/app/quarto/bin/toolslibrary'); library(knitr); pkgdown::build_site()" | R --slave
@ git add -u
@ git commit -m "Updated html doc to $(VERSION)."
all: doc install check test