Skip to content

Commit

Permalink
ci: fix lint, markdown links, and build (#282)
Browse files Browse the repository at this point in the history
Closes #269,
#275,
#279,
#222 (b/c no longer relevant)

Note: this PR removes code coverage. If we want it back, IMO it should
be a separate workflow.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
- Introduced new Makefile targets for linting and markdown link
checking.
  
- **Bug Fixes**
- Improved test reliability by ensuring correct variable capture in test
cases.

- **Documentation**
- Updated README files for clarity and accuracy, including installation
instructions and resource links.

- **Chores**
	- Updated Go version in project configuration.
- Streamlined workflow configurations for building and testing
processes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
rootulp authored Nov 15, 2024
1 parent 62ec215 commit 2fb6332
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 27 deletions.
23 changes: 7 additions & 16 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,23 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.21
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version-file: 'go.mod'
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Format
run: diff -u <(echo -n) <(gofmt -d .)

- name: Build
run: go build -v .

- name: Test and Coverage
- name: Test
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go test -v -coverpkg=./... -covermode=atomic -coverprofile coverage.txt ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
go test -v ./...
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
.sum
- uses: golangci/golangci-lint-action@v6
with:
version: latest
version: v1.61.0
args: --timeout 10m
if: env.GIT_DIFF

Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ run:

linters:
enable:
- exportloopref
- copyloopvar
- gofumpt
- misspell
- revive
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## lint: Run all linters; golangci-lint, markdownlint.
lint:
@echo "--> Running golangci-lint"
@golangci-lint run
@echo "--> Running markdownlint"
@markdownlint --config .markdownlint.yaml '**/*.md'
.PHONY: lint

## markdown-link-check: Check all markdown links.
markdown-link-check:
@echo "--> Running markdown-link-check"
@find . -name \*.md -print0 | xargs -0 -n1 markdown-link-check
.PHONY: markdown-link-check
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Namespaced Merkle Tree (NMT)

![Go version](https://img.shields.io/badge/go-1.21-blue.svg)
[![Go Reference](https://pkg.go.dev/badge/github.com/celestiaorg/nmt.svg)](https://pkg.go.dev/github.com/celestiaorg/nmt)
![golangci-lint](https://github.com/celestiaorg/nmt/workflows/lint/badge.svg)<!-- it retrieves the lint workflow status badge for the default branch i.e., main, for a different branch, specify the branch parameter in the URL() -->
![Go](https://github.com/celestiaorg/nmt/workflows/Go/badge.svg)
![codecov.io](https://codecov.io/github/celestiaorg/nmt/coverage.svg?branch=main)

A Namespaced Merkle Tree is
> [...] an ordered Merkle tree that uses a modified hash function
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/celestiaorg/nmt

go 1.21
go 1.23

require (
github.com/gogo/protobuf v1.3.2
Expand Down
8 changes: 3 additions & 5 deletions nmt_quint_model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ While this is not necessary, it is of great help when writing models.

## Basic resources

- a sequence of very gentle and fun tutorials
[here](https://github.com/informalsystems/quint/blob/main/tutorials/README.md)
- language [cheatsheet](https://github.com/informalsystems/quint/blob/main/doc/quint-cheatsheet.pdf)
- documentation for built-in operators
[here](https://github.com/informalsystems/quint/blob/main/doc/builtin.md)
- a sequence of [lessons](https://quint-lang.org/docs/lessons)
- language [cheatsheet](https://quint-lang.org/quint-cheatsheet.pdf)
- documentation for [built-in operators](https://quint-lang.org/docs/builtin)

## REPL

Expand Down
1 change: 0 additions & 1 deletion subrootpaths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ func TestPathGeneration(t *testing.T) {
}

for _, tc := range tests {
tc := tc
t.Run(tc.desc, func(t *testing.T) {
paths, err := GetSubrootPaths(tc.input.squareSize, tc.input.startNode, tc.input.length)
if !reflect.DeepEqual(pathResult(paths), tc.want) {
Expand Down

0 comments on commit 2fb6332

Please sign in to comment.