Skip to content

Commit

Permalink
[CI] Add ci workflows (#6)
Browse files Browse the repository at this point in the history
* feat: Add ci workflows

* chore: Disable go-lint workflow

* remove check_go_version

---------

Co-authored-by: Dmitry K. <[email protected]>
  • Loading branch information
red-0ne and okdas authored Jun 17, 2024
1 parent daaf0d9 commit 7a8056b
Show file tree
Hide file tree
Showing 5 changed files with 287 additions and 1 deletion.
77 changes: 77 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: Issue
about: A general purpose issue
title: "[REPLACE_WITH_IDENTIFIER] Provide a descriptive title"
labels: ""
assignees: ""
---

<!-- DELETE THIS COMMENT BLOCK
After completing the following:
1. Update _Assignee(s)_
2. Add _Label(s)_
3. Set _Project(s)_
4. Set _Milestone_
5. After the issue is created: specify _Epic_ and _Iteration_ under the _Project_ section
-->

## Objective

[ What? Describe the issue in 1-2 sentences]

## Origin Document

[ Why? Justify the issue in 1-2 sentences. Consider adding a link or a screenshot.]

## Goals

<!-- DELETE THIS COMMENT BLOCK
Provide a list of goals (not tasks) driving this issue.
These should not be actionable but guide the overarching goals we're aiming to achieve.
-->

- Goal #1
- Goal #2
- ...

## Deliverables

<!-- DELETE THIS COMMENT BLOCK
Make a list of deliverables that must be done to consider this task/issue resolved.
These should be very actionable, concrete and tangible.
-->

- [ ] Deliverable #1
- [ ] Deliverable #2
- ...

## Non-goals / Non-deliverables

<!-- DELETE THIS COMMENT BLOCK
Make a list of action items that are out of scope for this issue.
These should explicitly not be delivered as part of this issue and should be considered scope creep.
-->

- Non-goal #1
- Non-deliverable #2
- ...

## General deliverables

<!-- DELETE THIS COMMENT BLOCK
Remove sections that are not applicable to this PR.
-->

- [ ] **Comments**: Add/update TODOs and comments alongside the source code so it is easier to follow.
- [ ] **Testing**: Add new tests (unit and/or E2E) to the test suite.
- [ ] **Makefile**: Add new targets to the Makefile to make the new functionality easier to use.
- [ ] **Documentation**: Update architectural or development READMEs; use [mermaid](https://mermaid-js.github.io/mermaid/) diagrams where appropriate.

---

<!-- DELETE THIS COMMENT BLOCK
Remove `Co-Owners` if not applicable.
-->

**Creator**: [GitHub handle of issue owner]
**Co-Owners**: [OPTIONAL - GitHub handle of co-owner(s)]
41 changes: 41 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- README: DELETE THIS COMMENT BLOCK after:
1. Add a descriptive title `[<Tag>] <DESCRIPTION>`
2. Update _Assignee(s)_
3. Add _Label(s)_
4. Set _Project(s)_
5. Specify _Epic_ and _Iteration_ under _Project_
6. Set _Milestone_
-->

## Summary

<!-- README: DELETE THIS COMMENT BLOCK after
- Providing a quick summary of the changes yourself
-->

## Issue

<!-- README: DELETE THIS COMMENT BLOCK after:
- Explain the reasoning for the PR in 1-2 sentences. Adding a screenshot is fair game.
- If applicable: specify the ticket number below if there is a relevant issue; _keep the `-` so the full issue is referenced._
-->

- #{ISSUE_NUMBER}

## Type of change

Select one or more:

- [ ] New feature, functionality or library
- [ ] Bug fix
- [ ] Code health or cleanup
- [ ] Documentation
- [ ] Other (specify)

## Sanity Checklist

- [ ] I have tested my changes using the available tooling
- [ ] I have commented my code
- [ ] I have performed a self-review of my own code; both comments & source code
- [ ] I create and reference any new tickets, if applicable
- [ ] I have left TODOs throughout the codebase, if applicable
69 changes: 69 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: reviewdog

on:
pull_request:
branches: ["main"]

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

jobs:
# Makes sure that comments like TODO_IN_THIS_PR or TODO_IN_THIS_COMMIT block
# merging to main. See https://github.com/pokt-network/action-fail-on-found
check_todo_in_this:
name: Check TODO_IN_THIS_
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pokt-network/action-fail-on-found@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: error
fail_on_error: true
pattern: TODO_IN_THIS_

# Prevent the use of `sed` in helper scripts. This ensures compatibility across
# Darwin and Linux systems.
check_sed:
name: Check sed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pokt-network/action-fail-on-found@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: error
fail_on_error: true
pattern: sed -i .*

# There are multiple ways to validate (at compile time) that a struct
# implements a certain interface. This check enforces a common practice.
check_non_standard_interface_implementations:
name: Check for non-standard interface implementation statements
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pokt-network/action-fail-on-found@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: error
fail_on_error: true
pattern: var _ .* = &.*{}
ignore: .github,.git

# More info: https://github.com/reviewdog/action-misspell
check_misspell:
name: Check misspelling
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: warning
locale: "US"
33 changes: 33 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run tests

on:
push:
branches: ["main"]
pull_request:

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

env:
GKE_CLUSTER: protocol-us-central1
GKE_ZONE: us-central1

jobs:
go-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "0"

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22.2"

#- name: Run golangci-lint
# run: make go_lint

- name: Test
run: make test_all
68 changes: 67 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,70 @@
.PHONY: proto_regen ## Regenerate protobuf artifacts
proto_regen:
find proto -name "*.proto" -exec protoc --go_out=. --go_opt=paths=source_relative {} \;
find proto -name "*.pb.go" | sed 's/proto\///' | xargs -I {} mv proto/{} {}
find proto -name "*.pb.go" | sed 's/proto\///' | xargs -I {} mv proto/{} {}

.PHONY: test_all
test_all: ## Run all go tests showing detailed output only on failures
go test -count=1 -race -tags test ./...

###############
### Linting ###
###############

.PHONY: go_lint
go_lint: ## Run all go linters
golangci-lint run --timeout 5m --build-tags test

#############
### TODOS ###
#############

# How do I use TODOs?
# 1. <KEYWORD>: <Description of follow up work>;
# e.g. TODO_HACK: This is a hack, we need to fix it later
# 2. If there's a specific issue, or specific person, add that in paranthesiss
# e.g. TODO(@Olshansk): Automatically link to the Github user https://github.com/olshansk
# e.g. TODO_INVESTIGATE(#420): Automatically link this to github issue https://github.com/pokt-network/poktroll/issues/420
# e.g. TODO_DISCUSS(@Olshansk, #420): Specific individual should tend to the action item in the specific ticket
# e.g. TODO_CLEANUP(core): This is not tied to an issue, or a person, but should only be done by the core team.
# e.g. TODO_CLEANUP: This is not tied to an issue, or a person, and can be done by the core team or external contributors.
# 3. Feel free to add additional keywords to the list above.

# Inspired by @goldinguy_ in this post: https://goldin.io/blog/stop-using-todo ###
# TODO - General Purpose catch-all.
# TODO_COMMUNITY - A TODO that may be a candidate for outsourcing to the community.
# TODO_DECIDE - A TODO indicating we need to make a decision and document it using an ADR in the future; https://github.com/pokt-network/pocket-network-protocol/tree/main/ADRs
# TODO_TECHDEBT - Not a great implementation, but we need to fix it later.
# TODO_BLOCKER - BEFORE MAINNET. Similar to TECHDEBT, but of higher priority, urgency & risk prior to the next release
# TODO_QOL - AFTER MAINNET. Similar to TECHDEBT, but of lower priority. Doesn't deserve a GitHub Issue but will improve everyone's life.
# TODO_IMPROVE - A nice to have, but not a priority. It's okay if we never get to this.
# TODO_OPTIMIZE - An opportunity for performance improvement if/when it's necessary
# TODO_DISCUSS - Probably requires a lengthy offline discussion to understand next steps.
# TODO_INCOMPLETE - A change which was out of scope of a specific PR but needed to be documented.
# TODO_INVESTIGATE - TBD what was going on, but needed to continue moving and not get distracted.
# TODO_CLEANUP - Like TECHDEBT, but not as bad. It's okay if we never get to this.
# TODO_HACK - Like TECHDEBT, but much worse. This needs to be prioritized
# TODO_REFACTOR - Similar to TECHDEBT, but will require a substantial rewrite and change across the codebase
# TODO_CONSIDERATION - A comment that involves extra work but was thoughts / considered as part of some implementation
# TODO_CONSOLIDATE - We likely have similar implementations/types of the same thing, and we should consolidate them.
# TODO_ADDTEST / TODO_TEST - Add more tests for a specific code section
# TODO_FLAKY - Signals that the test is flaky and we are aware of it. Provide an explanation if you know why.
# TODO_DEPRECATE - Code that should be removed in the future
# TODO_RESEARCH - A non-trivial action item that requires deep research and investigation being next steps can be taken
# TODO_DOCUMENT - A comment that involves the creation of a README or other documentation
# TODO_BUG - There is a known existing bug in this code
# TODO_NB - An important note to reference later
# TODO_DISCUSS_IN_THIS_COMMIT - SHOULD NEVER BE COMMITTED TO MASTER. It is a way for the reviewer of a PR to start / reply to a discussion.
# TODO_IN_THIS_COMMIT - SHOULD NEVER BE COMMITTED TO MASTER. It is a way to start the review process while non-critical changes are still in progress

.PHONY: todo_list
todo_list: ## List all the TODOs in the project (excludes vendor and prototype directories)
grep --exclude-dir={.git,vendor,./docusaurus} -r TODO .

.PHONY: todo_count
todo_count: ## Print a count of all the TODOs in the project
grep --exclude-dir={.git,vendor,./docusaurus} -r TODO . | wc -l

.PHONY: todo_this_commit
todo_this_commit: ## List all the TODOs needed to be done in this commit
grep -n --exclude-dir={.git,vendor,.vscode,.idea} --exclude={Makefile,reviewdog.yml} -r -e "TODO_IN_THIS_"

0 comments on commit 7a8056b

Please sign in to comment.