Skip to content

Commit

Permalink
Merge branch 'master' into fix/gnot-mintable
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Jun 16, 2023
2 parents edd5d2d + 232754d commit 4a067d5
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# generate docs and publish on gh-pages branch
name: gh-pages

on:
push:
branches: [$default-branch]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: "cd misc/devdeps && make install"
- run: "cd misc/gendocs && make gen"
- run: "find docs/ -type f -ls"
- uses: actions/configure-pages@v3
id: pages
- uses: actions/upload-pages-artifact@v1
with:
path: ./misc/gendocs/godoc

deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
steps:
- uses: actions/deploy-pages@v2
id: deployment
4 changes: 2 additions & 2 deletions gnovm/pkg/gnolang/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ func (m *Machine) Release() {
m.NumOps = 0
m.NumValues = 0
// this is the fastest way to zero-in a slice in Go
copy(m.Ops, opZeroed[:0])
copy(m.Values, valueZeroed[:0])
copy(m.Ops, opZeroed[:])
copy(m.Values, valueZeroed[:])

machinePool.Put(m)
}
Expand Down
1 change: 1 addition & 0 deletions misc/devdeps/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
install:
go install mvdan.cc/gofumpt
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install golang.org/x/tools/cmd/godoc
3 changes: 3 additions & 0 deletions misc/devdeps/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ import (

// protoc, genproto
_ "google.golang.org/protobuf/cmd/protoc-gen-go"

// gen docs
_ "golang.org/x/tools/cmd/godoc"
)
1 change: 1 addition & 0 deletions misc/devdeps/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
github.com/peterbourgon/ff/v3 v3.3.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/stretchr/testify v1.7.1 // indirect
github.com/yuin/goldmark v1.4.13 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/exp v0.0.0-20221026153819-32f3d567a233 // indirect
Expand Down
2 changes: 2 additions & 0 deletions misc/devdeps/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions misc/gendocs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
godoc/
10 changes: 10 additions & 0 deletions misc/gendocs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all: clean gen

gen:
./gendocs.sh

clean:
rm -rf godoc

kill_zombies:
kill -9 `lsof -t -i tcp:6060 -s TCP:LISTEN` || true
35 changes: 35 additions & 0 deletions misc/gendocs/gendocs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

GODOC_PORT=${GODOC_PORT:-6060}
GO_MODULE=${GO_MODULE:-github.com/gnolang/gno}
GODOC_OUT=${GODOC_OUT:-godoc}
URL=http://localhost:${GODOC_PORT}/pkg/github.com/gnolang/gno/

echo "[+] Starting godoc server..."
go run \
-modfile ../devdeps/go.mod \
golang.org/x/tools/cmd/godoc \
-http="localhost:${GODOC_PORT}" &
PID=$!
# Waiting for godoc server
while ! curl --fail --silent "$URL" > /dev/null 2>&1; do
sleep 0.1
done

echo "[+] Downloading godoc pages..."
wget \
--recursive \
--no-verbose \
--convert-links \
--page-requisites \
--adjust-extension \
--execute=robots=off \
--include-directories="/lib,/pkg/$GO_MODULE,/src/$GO_MODULE" \
--exclude-directories="*" \
--directory-prefix="${GODOC_OUT}" \
--no-host-directories \
"$URL?m=all"

echo "[+] Killing godoc server..."
kill -9 "$PID"

0 comments on commit 4a067d5

Please sign in to comment.