Skip to content

Commit

Permalink
Merge branch 'master' into dev/moul/manfred-personal
Browse files Browse the repository at this point in the history
  • Loading branch information
moul authored Oct 28, 2023
2 parents a8b3e5d + e10f811 commit 71a4a16
Show file tree
Hide file tree
Showing 123 changed files with 4,003 additions and 688 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-author-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/auto-author-assign@v1.6.2
- uses: toshimaru/auto-author-assign@v2.0.1
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
with:
go-version: ${{ matrix.goversion }}
- run: go install -v ./gnovm/cmd/gno
- run: go run ./gnovm/cmd/gno test --verbose ./examples
- run: go run ./gnovm/cmd/gno test --verbose ./examples/...
lint:
strategy:
fail-fast: false
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: "cd misc/devdeps && make install"
- run: "cd misc/gendocs && make gen"
- run: "find docs/ -type f -ls"
- uses: actions/setup-go@v4
with:
go-version: "1.21.x"
- run: "cd misc/gendocs && make install gen"
- uses: actions/configure-pages@v3
id: pages
- uses: actions/upload-pages-artifact@v2
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/monthly-snapshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Monthly Snapshots

on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate tag name
id: tag_name
run: echo "::set-output name=tag_name::v0.0.1-dev.$(date +'%Y.%m.%d')"
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
prerelease: true
tag_name: '${{ steps.tag_name.outputs.tag_name }}'
12 changes: 12 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# man 5 gitmailmap
# git log --mailmap --pretty=short | grep ^Author: | sort -u
Jae Kwon <53785+jaekwon@users.noreply.github.com> Jae Kwon <jae@tendermint.com>
Jae Kwon <53785+jaekwon@users.noreply.github.com> Jae Kwon <jae@gno.land>
Jae Kwon <53785+jaekwon@users.noreply.github.com> jaekwon <jae@tendermint.com>
Jae Kwon <53785+jaekwon@users.noreply.github.com> Naut Jae <naut_jae@Nauts-Mac-mini.local>
Thomas Bruyelle <thomas.bruyelle@tendermint.com> Thomas Bruyelle <thomas.bruyelle@gmail.com>
Thomas Bruyelle <thomas.bruyelle@tendermint.com> Thomas Bruyelle <thomasbruyelle@hey.com>
Miloš Živković <milos.zivkovic@tendermint.com> Miloš Živković <milos@zmilos.com>
Hariom Verma <hariom.verma@tendermint.com> Hariom Verma <hariom18599@gmail.com>
Giancarlos Salas <me@giansalex.dev> Giancarlos Salas <giansalex@gmail.com>
Morgan <morgan@morganbaz.com> Morgan <git@howl.moe>
146 changes: 125 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contributing to GNO
# Contributing to Gno

Thank you for looking to contribute to the GNO project.
We appreciate every open-source contribution, as it helps us improve and enhance gno for the benefit of the community.
Thank you for looking to contribute to the Gno project.
We appreciate every open-source contribution, as it helps us improve and enhance Gno for the benefit of the community.

This document outlines some basic pointers on making your future contribution a great experience. It outlines basic PR
etiquette employed by the core gno team. It lays out coding styles, simple how-to guides and tools to get you up and
Expand All @@ -20,7 +20,7 @@ Likewise, if you have an idea on how to improve this guide, go for it as well.
- [Testing](#testing)
- [Running locally](#running-locally)
- [Running test workflows](#running-test-workflows)
- [Testing GNO code](#testing-gno-code)
- [Testing Gno code](#testing-gno-code)
- [Repository Structure](#repository-structure)
- [How do I?](#how-do-i)
- [How do I submit changes?](#how-do-i-submit-changes)
Expand All @@ -41,9 +41,9 @@ Likewise, if you have an idea on how to improve this guide, go for it as well.

- **[Discord](https://discord.gg/YFtMjWwUN7)** - we are very active on Discord. Join today and start discussing all
things gno with fellow engineers and enthusiasts.
- **[Awesome GNO](https://github.com/gnolang/awesome-gno)** - check out the list of compiled resources for helping you
- **[Awesome Gno](https://github.com/gnolang/awesome-gno)** - check out the list of compiled resources for helping you
understand the gno ecosystem
- **[Active Staging](https://gno.land/)** - use the currently available staging environment to play around with a
- **[Active Staging](https://staging.gno.land/)** - use the currently available staging environment to play around with a
production network. If you want to interact with a local instance, refer to the [Local Setup](#local-setup) guide.
- **[Twitter](https://twitter.com/_gnoland)** - follow us on Twitter to get the latest scoop
- **[Telegram](https://t.me/gnoland)** - join our official Telegram group to start a conversation about gno
Expand All @@ -58,7 +58,6 @@ The primary tech stack for working on the repository:

- Go (version 1.20+)
- make (for using Makefile configurations)
- Docker (for using the official Docker setup files)

It is recommended to work on a Unix environment, as most of the tooling is built around ready-made tools in Unix (WSL2
for Windows / Linux / macOS).
Expand All @@ -67,13 +66,21 @@ For Gno, there is no specific tooling that needs to be installed, that’s not a
You can utilize the `gno` command to facilitate Gnolang support when writing Smart Contracts in Gno, by installing it
with `make install_gno`.

If you are working on Go source code on this repository, `pkg.go.dev` will not
render our documentation as it has a license it does not recognise. Instead, use
the `go doc` command, or use our statically-generated documentation:
https://gnolang.github.io/gno/github.com/gnolang/gno.html

Additionally, you can also configure your editor to recognize `.gno` files as `.go` files, to get the benefit of syntax
highlighting.

Currently, we support a [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=harry-hov.gno) extension
(eventually official in the future) for Gnolang.
#### Visual Studio Code

There currently is an unofficial [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=harry-hov.gno)
extension (primarily developed by a core team member) for working with `*.gno`
files.

#### ViM Support
#### ViM Support (without LSP)

Add to your `.vimrc` file:

Expand All @@ -97,9 +104,68 @@ To use *gofumpt* instead of *gofmt*, as hinted in the comment, you may either ha
cexpr system('go run -modfile </path/to/gno>/misc/devdeps/go.mod mvdan.cc/gofumpt -w ' . expand('%'))
```

### ViM Support (with LSP)

There is an experimental and unofficial [Gno Language Server](https://github.com/jdkato/gnols)
developed by the community, with an installation guide for Neovim.

For ViM purists, you have to install the [`vim-lsp`](https://github.com/prabirshrestha/vim-lsp)
plugin and then register the LSP server in your `.vimrc` file:

```vim
augroup gno_autocmd
autocmd!
autocmd BufNewFile,BufRead *.gno
\ set filetype=gno |
\ set syntax=go
augroup END
if (executable('gnols'))
au User lsp_setup call lsp#register_server({
\ 'name': 'gnols',
\ 'cmd': ['gnols'],
\ 'allowlist': ['gno'],
\ 'config': {},
\ 'workspace_config': {
\ 'root' : '/path/to/gno_repo',
\ 'gno' : '/path/to/gno_bin',
\ 'precompileOnSave' : v:true,
\ 'buildOnSave' : v:false,
\ },
\ 'languageId': {server_info->'gno'},
\ })
else
echomsg 'gnols binary not found: LSP disabled for Gno files'
endif
function! s:on_lsp_buffer_enabled() abort
" Autocompletion
setlocal omnifunc=lsp#complete
" Format on save
autocmd BufWritePre <buffer> LspDocumentFormatSync
" Some optionnal mappings
nmap <buffer> <leader>i <Plug>(lsp-hover)
" Following mappings are not supported yet by gnols
" nmap <buffer> gd <plug>(lsp-definition)
" nmap <buffer> <leader>rr <plug>(lsp-rename)
endfunction
augroup lsp_install
au!
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END
```

Note that unlike the previous ViM setup without LSP, here it is required by
`vim-lsp` to have a specific `filetype=gno`. Syntax highlighting is preserved
thanks to `syntax=go`.

Inside `lsp#register_server()`, you also have to replace
`workspace_config.root` and `workspace_config.gno` with the correct directories
from your machine.

Additionaly, it's not possible to use `gofumpt` for code formatting with
`gnols` for now.

#### Emacs Support

1. Install [go-mode.el](https://github.com/dominikh/go-mode.el).
Expand All @@ -122,9 +188,36 @@ Clone the repo:
`git clone https://github.com/gnolang/gno.git`

Build / install base commands:
`make build `
`make install`

If you haven't already, you may need to add the directory where [`go install`
places its binaries](https://pkg.go.dev/cmd/go#hdr-Compile_and_install_packages_and_dependencies)
to your `PATH`. If you haven't configured `GOBIN` or `GOPATH` differently, this
command should suffice:

```
echo 'export PATH="$HOME/go/bin:$PATH"' >> ~/.profile
source ~/.profile # reload ~/.profile in the current shell
```

After that, you should be good to go to use `gno` and `gnokey`, straight from
your command line! The following commands should list the help messages for
each:

That’s it!
```console
$ gno --help
USAGE
<subcommand> [flags] [<arg>...]

Runs the gno development toolkit
[...]
$ gnokey --help
USAGE
<subcommand> [flags] [<arg>...]

Manages private keys for the node
[...]
```

### Testing

Expand All @@ -151,7 +244,7 @@ To run the entire test suite through workflow files, run the following command:

act -v -j go-test

#### Testing GNO code
#### Testing Gno code

If you wish to test a `.gno` Realm or Package, you can utilize the `gno` tool.

Expand All @@ -169,24 +262,35 @@ subcommands by running:

gno --help

#### Adding new tests

Most packages will follow the convention established with Go: each package
contains within its file many files suffixed with `_test.go` which test its
functionality. As a general rule, you should follow this convention, and in
every PR you make you should ensure all the code you added is appropriately
covered by tests ([Codecov](https://about.codecov.io/) will loudly complain in
your PR's comments if you don't).

Additionally, we have a few testing systems that stray from this general rule;
at the time of writing, these are for integration tests and language tests. You
can find more documentation about them [on this guide](gno/docs/testing-guide.md).

### Repository Structure

The repository structure can seem tricky at first, but it’s simple if you consider the philosophy that the gno project
employs (check out [PHILOSOPHY.md](https://github.com/gnolang/gno/blob/master/PHILOSOPHY.md)).
employs (check out [PHILOSOPHY.md](./PHILOSOPHY.md)).

The gno project currently favors a mono-repo structure, as it’s easier to manage contributions and keep everyone
aligned. In the future, this may change, but in the meantime the majority of gno resources and source code will be
centralized here.

- `cmd` - contains the base command implementations for tools like `gnokey`, `gnotxport`, etc. The actual underlying
logic is located within the `pkgs` subdirectories.
- `examples` - contains the example `.gno` realms and packages. This is the central point for adding user-defined realms
and packages.
- `gnoland` - contains the base source code for bootstrapping the Gnoland node
- `pkgs` - contains the dev-audited packages used throughout the gno codebase
- `stdlibs` - contains the standard library packages used (imported) in `.gno` Smart Contracts. These packages are
themselves `.gno` files.
- `tests` - contains the standard language tests for Gnolang
- `gno.land` - contains the base source code for bootstrapping the Gnoland node,
using `tm2` and `gnovm`.
- `gnovm` - contains the implementation of the Gno programming language and its
Virtual Machine, together with their standard libraries and tests.
- `tm2` - contains a fork of the [Tendermint consensus engine](https://docs.tendermint.com/v0.34/introduction/what-is-tendermint.html) with different expectations.

## How do I?

Expand Down
Loading

0 comments on commit 71a4a16

Please sign in to comment.