Merge pull request #959 from status-im/publish

Makefile: add "publish-book" target
This commit is contained in:
Ștefan Talpalaru 2020-05-02 20:57:23 +02:00 committed by GitHub
commit 3ac01140c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 6 deletions

View File

@ -48,7 +48,11 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
clean-testnet1 \ clean-testnet1 \
testnet1 \ testnet1 \
clean \ clean \
libbacktrace libbacktrace \
schlesi \
schlesi-dev \
book \
publish-book
ifeq ($(NIM_PARAMS),) ifeq ($(NIM_PARAMS),)
# "variables.mk" was not included, so we update the submodules. # "variables.mk" was not included, so we update the submodules.
@ -153,5 +157,21 @@ libnfuzz.a: | build deps
$(ENV_SCRIPT) nim c -d:release --app:staticlib --noMain --nimcache:nimcache/libnfuzz_static -o:build/$@ $(NIM_PARAMS) nfuzz/libnfuzz.nim && \ $(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 [[ -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 || true; } && \
cd .. && \
git worktree remove -f tmp-book && \
rm -rf tmp-book
endif # "variables.mk" was not included endif # "variables.mk" was not included

View File

@ -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 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 ## License
Licensed and distributed under either of Licensed and distributed under either of

2
docs/.gitignore vendored
View File

@ -1 +1 @@
book /book

View File

@ -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 [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: If you don't want to compile PCRE separately, you can fetch pre-compiled DLLs with:
```bash ```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 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: After cloning the repo:
```bash ```bash
make # The first `make` invocation will update all Git submodules and prompt you to run `make` again. # The first `make` invocation will update all Git submodules.
# It's only required once per Git clone. You'll run `make update` after each `git pull`, in the future, # You'll run `make update` after each `git pull`, in the future, to keep those submodules up to date.
# to keep those submodules up to date. make
# Run tests # Run tests
make test make test