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 Nov 10, 2023
2 parents 71a4a16 + 98f384e commit 381fe8b
Show file tree
Hide file tree
Showing 523 changed files with 24,970 additions and 2,662 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ PHILOSOPHY.md @jaekwon @moul
CONTRIBUTING.md @jaekwon @moul
LICENSE.md @jaekwon @moul
.github/CODEOWNERS @jaekwon @moul

# Documentation.
docs/* @gnolang/devrels
27 changes: 24 additions & 3 deletions .github/golangci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
run:
timeout: 5m
concurrency: 8
timeout: 10m
issue-exit-code: 1
tests: true
skip-dirs-use-default: true
modules-download-mode: readonly
allow-parallel-runners: false
go: ""

output:
uniq-by-line: false
path-prefix: ""
sort-results: true

linters:
fast: false
disable-all: true
enable:
- whitespace # Tool for detection of leading and trailing whitespace
Expand All @@ -21,12 +32,11 @@ linters:
- gofmt # Whether the code was gofmt-ed
- goimports # Unused imports
- goconst # Repeated strings that could be replaced by a constant
#- forcetypeassert # Finds forced type assertions
- dogsled # Checks assignments with too many blank identifiers (e.g. x, , , _, := f())
#- dupl # Code clone detection
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13
- gofumpt # Stricter gofmt
- unused # Checks Go code for unused constants, variables, functions and types

linters-settings:
gofmt:
Expand All @@ -42,9 +52,20 @@ linters-settings:
checks: [ "all", "-ST1022", "-ST1003" ]
errorlint:
asserts: false
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style

issues:
whole-files: true
max-issues-per-linter: 0
max-same-issues: 0
new: false
fix: false
exclude-rules:
- path: _test\.go
linters:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/contribs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: contribs

on:
push:
branches: [ "master" ]
pull_request:
paths:
- "contribs/**"
- ".github/workflows/contribs.yml"
- "gnovm/**.go"
- "gno.land/**.go"
- "tm2/**.go"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
install:
strategy:
fail-fast: false
matrix:
goversion: # two latest versions
- "1.21.x"
program:
- "gnomd"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goversion }}
- run: make install ${{ matrix.program }}
working-directory: contribs
29 changes: 29 additions & 0 deletions .github/workflows/docusaurus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: docusaurus build
on:
pull_request:
paths:
- "docs/**"
push:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install Docusaurus Dependencies
run: |
cd misc/docusaurus
yarn install
- name: Build Docusaurus Docs
run: |
cd misc/docusaurus
yarn build
19 changes: 19 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,22 @@ jobs:
- run: go run ./gnovm/cmd/gno lint --verbose ./examples/gno.land/r/gnoland
- run: go run ./gnovm/cmd/gno lint --verbose ./examples/gno.land/r/system
# TODO: track coverage
mod-tidy:
strategy:
fail-fast: false
matrix:
go-version: [ "1.21.x" ]
# unittests: TODO: matrix with contracts
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v4
- run: |
GNO_CMD="$(pwd)/gnovm/cmd/gno"
# Find all directories containing gno.mod file
find ./examples -name "gno.mod" -execdir go run "$GNO_CMD" mod tidy \;
# Check if there are changes after running gno mod tidy
git diff --exit-code || (echo "Some gno.mod files are not tidy, please run 'make tidy'." && exit 1)
8 changes: 3 additions & 5 deletions .github/workflows/gnoland.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ jobs:
- _test.gnoland
- _test.gnokey
- _test.pkgs
# XXX: test broken, should be rewritten to run an inmemory localnode
# Re-add to makefile when fixed. Tracked here: https://github.com/gnolang/gno/issues/1222
#- _test.gnoweb
- _test.gnoweb
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand All @@ -78,7 +76,7 @@ jobs:
export LOG_DIR="${{ runner.temp }}/logs/test-${{ matrix.goversion }}-gnoland"
make ${{ matrix.args }}
- name: Upload Test Log
if: always()
if: always()
uses: actions/upload-artifact@v3
with:
name: logs-test-gnoland-go${{ matrix.goversion }}
Expand All @@ -101,7 +99,7 @@ jobs:
uses: codecov/codecov-action@v3
with:
directory: ${{ runner.temp }}/coverage
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }}

docker-integration:
Expand Down
43 changes: 38 additions & 5 deletions .github/workflows/gnovm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,35 +67,68 @@ jobs:
- _test.gnolang.other
runs-on: ubuntu-latest
timeout-minutes: 15
env:
COVERAGE_DIR: "/tmp/coverage"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goversion }}
- name: test
working-directory: gnovm
env:
TXTARCOVERDIR: ${{ env.COVERAGE_DIR }}
run: |
mkdir -p $COVERAGE_DIR
# Setup testing environements variables
export GOPATH=$HOME/go
export GOTEST_FLAGS="-v -p 1 -timeout=30m -coverprofile=coverage.out -covermode=atomic"
export GOTEST_FLAGS="-v -p 1 -timeout=30m -covermode=atomic -test.gocoverdir=$COVERAGE_DIR"
# Run target test
make ${{ matrix.args }}
- uses: actions/upload-artifact@v3
if: ${{ runner.os == 'Linux' && matrix.goversion == '1.21.x' }}
with:
name: ${{runner.os}}-coverage-gnovm-${{ matrix.args}}-${{matrix.goversion}}
path: ./gnovm/coverage.out
path: ${{ env.COVERAGE_DIR }}

upload-coverage:
needs: test
runs-on: ubuntu-latest
env:
COVERAGE_DATA: /tmp/coverage/coverage-raw
COVERAGE_OUTPUT: /tmp/coverage/coverage-out
COVERAGE_PROFILE: /tmp/coverage/coverage.txt
steps:
- name: Download all previous coverage artifacts
- run: mkdir -p $COVERAGE_DATA $COVERAGE_OUTPUT
- name: Download all previous coverage data artifacts
uses: actions/download-artifact@v3
with:
path: ${{ runner.temp }}/coverage
path: ${{ env.COVERAGE_DATA }}
- uses: actions/setup-go@v4
with:
go-version: "1.21.x"
- name: Merge coverages
working-directory: ${{ env.COVERAGE_DATA }}
run: |
# Create coverage directory list separate by comma
export COVERAGE_DIRS="$(ls | tr '\n' ',' | sed s/,$//)"
# Merge all coverage data directories from previous tests
go tool covdata merge -v 1 -i="$COVERAGE_DIRS" -o $COVERAGE_OUTPUT
# Print coverage percent for debug purpose if needed
echo 'coverage results:'
go tool covdata percent -i=$COVERAGE_OUTPUT
# Generate coverage profile
go tool covdata textfmt -v 1 -i=$COVERAGE_OUTPUT -o $COVERAGE_PROFILE
- name: Upload combined coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: ${{ runner.temp }}/coverage
files: ${{ env.COVERAGE_PROFILE }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }}

5 changes: 3 additions & 2 deletions .github/workflows/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ jobs:

- name: Check go.mods
run: |
sums="$(sha256sum go.mod misc/devdeps/go.mod)"
for path in . ./misc/devdeps; do
gomods=$(find . -type f -name go.mod)
sums="$(sha256sum ${gomods})"
for path in $(dirname $(gomods)); do
env -C $path go mod tidy -v || exit 1
done
echo "$sums" | sha256sum -c
4 changes: 2 additions & 2 deletions .github/workflows/tm2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- _test.pkg.bft
- _test.pkg.others
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 21
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
Expand All @@ -65,7 +65,7 @@ jobs:
working-directory: tm2
run: |
export GOPATH=$HOME/go
export GOTEST_FLAGS="-v -p 1 -timeout=30m -coverprofile=coverage.out -covermode=atomic"
export GOTEST_FLAGS="-v -p 1 -timeout=20m -coverprofile=coverage.out -covermode=atomic"
make ${{ matrix.args }}
touch coverage.out
- uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Likewise, if you have an idea on how to improve this guide, go for it as well.

### Environment

The gno repository is primarily based on Golang (Go), and Gnolang (Gno).
The gno repository is primarily based on Golang (Go) and Gnolang (Gno).

The primary tech stack for working on the repository:

Expand Down
2 changes: 1 addition & 1 deletion PHILOSOPHY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Readability is paramount - beautiful is better than fast.
* Minimal code - keep total footprint small.
* Minimal dependencies - all dependencies must get audited, and become part of the repo.
* Modular dependencies - whereever reasonable, make components modular.
* Modular dependencies - wherever reasonable, make components modular.
* Finished - software projects that don't become finished are projects that
are forever vulnerable. One of the primary goals of the Gno language and
related works is to become finished within a reasonable timeframe.
Expand Down
30 changes: 30 additions & 0 deletions contribs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.PHONY: help
help:
@echo "Available make commands:"
@cat Makefile | grep '^[a-z][^:]*:' | cut -d: -f1 | sort | sed 's/^/ /'

.PHONY: install
install: install.gnomd

install.gnomd:; cd gnomd && go install .

.PHONY: clean
clean:
rm -rf build

########################################
# Dev tools
rundep=go run -modfile ../misc/devdeps/go.mod

.PHONY: fmt
GOFMT_FLAGS ?= -w
fmt:
$(rundep) mvdan.cc/gofumpt $(GOFMT_FLAGS) .

########################################
# Test suite
GOTEST_FLAGS ?= -v -p 1 -timeout=30m

.PHONY: test
test:
@echo "nothing to do."
17 changes: 17 additions & 0 deletions contribs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Gno Contribs

This directory houses additional commands and tools designed to enhance your Gno experience.
These tools can range from simple wrappers for `gno`, `gnoland`, and `gnokey` to complete applications.
Some may be Go binaries with their own `go.mod` files, allowing the use of specialized libraries,
while others may be shell scripts or programs written in different languages.

## Contributing Guidelines

If you'd like to contribute a tool to Gno Contribs, please follow these guidelines:

1. **Naming**: Choose a clear and concise name for your tool, starting with one of the prefixes: `gno`, `gnoland`, or `gnokey`,
followed by a short descriptive word or abbreviation.
This naming convention helps users identify the purpose of the tool easily.

2. **User-Friendly**: Ensure that your tool is user-friendly and follows a similar style to other Gno tools,
providing a consistent experience for users.
16 changes: 16 additions & 0 deletions contribs/gnokeykc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# `gnokeykc`

`gnokeykc` is a Go-based CLI tool that enhances [`gnokey`](../../gno.land/cmd/gnokey) by integrating with your system's keychain. It adds `gnokey kc ...` subcommands to set and unset passwords in the keychain, allowing Gnokey to fetch passwords directly from the keychain instead of prompting for terminal input.

## Usage

gnokey kc -h

## Terminal Alias

For ease of use, set up a terminal alias to replace `gnokey` with `gnokeykc`:

echo "alias gnokey='gnokeykc'" >> ~/.bashrc && source ~/.bashrc

Now, `gnokey` commands will use `gnokeykc`, fetching passwords from the keychain.

Loading

0 comments on commit 381fe8b

Please sign in to comment.