From 43679bd04fbe8ccab4231b84d3f3b12e896e0925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Sat, 2 May 2020 16:30:34 +0200 Subject: [PATCH 1/2] Makefile: add "publish-book" target See https://github.com/rust-lang/mdBook/blob/master/book-example/src/continuous-integration.md#deploying-to-github-pages-manually --- Makefile | 21 ++++++++++++++++++++- README.md | 6 ++++++ docs/.gitignore | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e5dbfdbe1..6b816cdb8 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,11 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS)) clean-testnet1 \ testnet1 \ clean \ - libbacktrace + libbacktrace \ + schlesi \ + schlesi-dev \ + book \ + publish-book ifeq ($(NIM_PARAMS),) # "variables.mk" was not included, so we update the submodules. @@ -153,5 +157,20 @@ libnfuzz.a: | build deps $(ENV_SCRIPT) nim c -d:release --app:staticlib --noMain --nimcache:nimcache/libnfuzz_static -o:build/$@ $(NIM_PARAMS) nfuzz/libnfuzz.nim && \ [[ -e "$@" ]] && mv "$@" build/ # workaround for https://github.com/nim-lang/Nim/issues/12745 +book: + cd docs && \ + mdbook build + +publish-book: | book + git worktree add tmp-book gh-pages && \ + rm -rf tmp-book/* && \ + cp -a docs/book/* tmp-book/ && \ + cd tmp-book && \ + git add . && \ + git commit -m "make publish-book" && \ + git push origin gh-pages && \ + git worktree remove -f tmp-book && \ + rm -rf tmp-book + endif # "variables.mk" was not included diff --git a/README.md b/README.md index 4813967e5..aca2cd4d7 100644 --- a/README.md +++ b/README.md @@ -354,6 +354,12 @@ make -j$(nproc) NIMFLAGS="-d:release" USE_MULTITAIL=yes eth2_network_simulation make USE_LIBBACKTRACE=0 # expect the resulting binaries to be 2-3 times slower ``` +- publish a book using [mdBook](https://github.com/rust-lang/mdBook) from sources in "docs/" to GitHub pages: + +```bash +make publish-book +``` + ## License Licensed and distributed under either of diff --git a/docs/.gitignore b/docs/.gitignore index 7585238ef..5a0bf0317 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1 +1 @@ -book +/book From fa7d64c291fd62d2b29cec22bd6d6258664e8860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Sat, 2 May 2020 16:46:24 +0200 Subject: [PATCH 2/2] Makefile fix --- Makefile | 7 ++++--- docs/src/advanced.md | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 6b816cdb8..3bbdb4041 100644 --- a/Makefile +++ b/Makefile @@ -166,9 +166,10 @@ publish-book: | book rm -rf tmp-book/* && \ cp -a docs/book/* tmp-book/ && \ cd tmp-book && \ - git add . && \ - git commit -m "make publish-book" && \ - git push origin gh-pages && \ + git add . && { \ + git commit -m "make publish-book" && \ + git push origin gh-pages || true; } && \ + cd .. && \ git worktree remove -f tmp-book && \ rm -rf tmp-book diff --git a/docs/src/advanced.md b/docs/src/advanced.md index c4bf52603..742db630d 100644 --- a/docs/src/advanced.md +++ b/docs/src/advanced.md @@ -16,9 +16,22 @@ Variables -> Path -> Edit -> New -> C:\mingw-w64\mingw64\bin (it's "C:\mingw-w64 Install [Git for Windows](https://gitforwindows.org/) and use a "Git Bash" shell to clone and build nim-beacon-chain. +Install [CMake](https://cmake.org/) to be able to build libunwind (used for [lightweight stack traces](https://github.com/status-im/nim-libbacktrace)). + +When running the tests, you might hit some Windows path length limits. Increase them by editing the Registry in a PowerShell instance with administrator privileges: + +```powershell +Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 +``` + +and run this in a "Git Bash" terminal: + +```bash +git config --global core.longpaths true +``` + If you don't want to compile PCRE separately, you can fetch pre-compiled DLLs with: ```bash -mingw32-make # this first invocation will update the Git submodules mingw32-make fetch-dlls # this will place the right DLLs for your architecture in the "build/" directory ``` @@ -35,9 +48,9 @@ mingw32-make test # run the test suite After cloning the repo: ```bash -make # The first `make` invocation will update all Git submodules and prompt you to run `make` again. - # It's only required once per Git clone. You'll run `make update` after each `git pull`, in the future, - # to keep those submodules up to date. +# The first `make` invocation will update all Git submodules. +# You'll run `make update` after each `git pull`, in the future, to keep those submodules up to date. +make # Run tests make test