Skip to content

Commit

Permalink
ci: migrate code quality tooling from Codecov to Sonar Cloud (cosmos#…
Browse files Browse the repository at this point in the history
…2598)

* remove codecov and add sonarcloud

* remove /tools folder

* add sonarcloud properties

* update README.md
  • Loading branch information
mpoke authored Jun 16, 2023
1 parent 1c8b069 commit 605e5db
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 89 deletions.
83 changes: 52 additions & 31 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,35 @@ on:
- "**/*.md"
- "docs/**"

jobs:
cleanup-runs:
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
permissions:
contents: read

test-coverage-upload:
concurrency:
group: ci-${{ github.ref }}-tests
cancel-in-progress: true

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: technote-space/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/**.go
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
**/Makefile
Makefile
- uses: actions/[email protected]
with:
path: |
Expand All @@ -39,29 +49,15 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: test & coverage report creation
if: env.GIT_DIFF
run: |
go test -v -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... $(go list ./... | grep -v -e '/tests/e2e')
- name: filter non-testable files
run: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
excludelist+=" $(find ./ -type f -name '*.pb.go')"
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')"
excludelist+=" $(find ./cmd -type d)"
excludelist+=" $(find ./tests -type d)"
for filename in ${excludelist}; do
filename=${filename#".//"}
echo "Excluding ${filename} from coverage report..."
filename=$(echo "$filename" | sed 's/\//\\\//g')
sed -i.bak "/""$filename""/d" coverage.txt
done
- uses: codecov/[email protected]
go test -v -coverprofile=profile.out -covermode=atomic -coverpkg=./... $(go list ./... | grep -v -e '/tests/e2e')
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
file: ./coverage.txt
fail_ci_if_error: true
name: "${{ github.sha }}-coverage"
path: ./profile.out

test-e2e:
runs-on: ubuntu-latest
Expand All @@ -82,6 +78,31 @@ jobs:
- name: Test E2E
run: make test-e2e

repo-analysis:
runs-on: ubuntu-latest
needs: [tests]
steps:
- uses: actions/checkout@v3
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
- uses: actions/download-artifact@v3
if: env.GIT_DIFF
with:
name: "${{ github.sha }}-coverage"
- name: sonarcloud
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

liveness-test:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
72 changes: 28 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,81 @@
<div align="center">
<img src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F643ab9b2-4062-4367-99f6-59c0f7507e22%2FGroup_1041.png?table=block&id=23fcc36a-07b6-46a5-84d6-2f4a5569cd6e&spaceId=2fa227ac-dee8-4655-ad64-fe3c359def5a&width=250&userId=b57d8bef-0356-4537-8ae8-7251a098e5b3&cache=v2" width="100" height="100" />

<hr height="0.5px" />

<br/>

<h1> Cosmos Hub (Gaia) </h1>
<p> The Cosmos Hub is the first of an exploding number of interconnected blockchains that comprise the Cosmos Network. </p>

<a href="https://twitter.com/cosmoshub"><img src="https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white" alt="Tweet" height="20"/></a>
<br/>
</div>

<hr/>

<div align="center">
<img src="https://miro.medium.com/max/2000/1*DHtmSfS_Efvuq8n2LAnhkA.png" />
</div>
# Cosmos Hub (Gaia)

![Banner!](https://miro.medium.com/max/2000/1*DHtmSfS_Efvuq8n2LAnhkA.png)

[![Project Status: Active -- The project has reached a stable, usable state and is being actively
developed.](https://img.shields.io/badge/repo%20status-Active-green.svg)](https://www.repostatus.org/#active)
[![License: Apache-2.0](https://img.shields.io/github/license/cosmos/gaia.svg)](https://github.com/cosmos/gaia/blob/main/LICENSE)
[![Version](https://img.shields.io/github/tag/cosmos/gaia.svg)](https://github.com/cosmos/gaia/releases/latest)
[![Go Report Card](https://goreportcard.com/badge/github.com/cosmos/gaia)](https://goreportcard.com/report/github.com/cosmos/gaia)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue?logo=go)](https://pkg.go.dev/github.com/cosmos/gaia)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=cosmos_gaia&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=cosmos_gaia)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cosmos_gaia&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=cosmos_gaia)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=cosmos_gaia&metric=coverage)](https://sonarcloud.io/summary/new_code?id=cosmos_gaia)
[![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/cosmosnetwork)
[![Twitter](https://badgen.net/badge/icon/twitter?icon=twitter&label)](https://twitter.com/cosmoshub)

The Cosmos Hub is the first of an exploding number of interconnected blockchains that comprise the Cosmos Network.

<br/>

### 🤔 — Why should you be interested in the Cosmos Hub
## 🤔 — Why should you be interested in the Cosmos Hub

___

The Cosmos Hub is built using the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) and compiled to a binary called `gaiad` (Gaia Daemon). The Cosmos Hub and other fully sovereign Cosmos SDK blockchains interact with one another using a protocol called [IBC](https://github.com/cosmos/ibc) that enables Inter-Blockchain Communication. In order to understand what the Cosmos Hub is you can read this [introductory explanation](https://hub.cosmos.network/main/hub-overview/overview.html).

| | | | | |
| --- | --- | --- | --- | --- |
| [![codecov](https://codecov.io/gh/cosmos/gaia/branch/master/graph/badge.svg)](https://codecov.io/gh/cosmos/gaia) | [![Go Report Card](https://goreportcard.com/badge/github.com/cosmos/gaia)](https://goreportcard.com/report/github.com/cosmos/gaia) | [![license](https://img.shields.io/github/license/cosmos/gaia.svg)](https://github.com/cosmos/gaia/blob/main/LICENSE) | [![LoC](https://tokei.rs/b1/github/cosmos/gaia)](https://github.com/cosmos/gaia) | [![GolangCI](https://golangci.com/badges/github.com/cosmos/gaia.svg)](https://golangci.com/r/github.com/cosmos/gaia) |

<br/>
<br/>

### ⚡ — Documentation & Introduction
## ⚡ — Documentation & Introduction

___

Cosmos Hub is a blockchain network that operates on Proof-of-Stake consensus. You can find an introduction to the Cosmos Hub and how to use the `gaiad` binary as a delegator, validator or node operator as well as how governance on the Cosmos Hub works in the [documentation](https://hub.cosmos.network/main/hub-overview/overview.html).

Alternatively, whether you're new to blockchain technology or interested in getting involved, the Cosmos Network [Course](https://tutorials.cosmos.network/academy/0-welcome/) will guide you through everything. The course walks you through the basics of blockchain technology, to staking, setting up your own node, and beyond.

<br/>
<br/>

### 👤 — Node Operators
## 👤 — Node Operators

___
If you're interested in running a node on the current Cosmos Hub, check out the docs to [Join the Cosmos Hub Mainnet](https://github.com/cosmos/gaia/blob/main/docs/hub-tutorials/join-mainnet.md).

<br/>
<br/>

### 🗣️ — Validators
## 🗣️ — Validators

___

If you want to participate and help secure Cosmos Hub, check out becoming a validator. Information on what a validator is and how to participate as one can be found at the [Validator FAQ](https://hub.cosmos.network/main/validators/validator-faq.html#). If you're running a validator node on the Cosmos Hub, reach out to a Janitor on the [Cosmos Developers Discord](https://discord.gg/cosmosnetwork) to join the `#cosmos-hub-validators-verified` channel.

<br/>
<br/>

### 👥 — Delegators
## 👥 — Delegators

___

If you still want to participate on the Cosmos Hub, check out becoming a delegator. Information on what a delegator is and how to participate as one can be found at the [Delegator FAQ](https://hub.cosmos.network/main/delegators/delegator-faq.html).

<br/>
<br/>

### 👥 — Testnet
## 👥 — Testnet

___

To participate in or utilize the current Cosmos Hub testnet, take a look at the [cosmos/testnets](https://github.com/cosmos/testnets) repository. This testnet is for the Theta Upgrade expected in Q1 2022. For future upgrades of the Cosmos Hub take a look at the [roadmap](https://github.com/cosmos/gaia/blob/main/docs/roadmap/cosmos-hub-roadmap-2.0.md).

<br/>
<br/>

### 🌐 — Roadmap
## 🌐 — Roadmap

___

For an overview of upcoming changes to the Cosmos Hub take a look at the [Roadmap](https://github.com/cosmos/gaia/blob/main/docs/roadmap/cosmos-hub-roadmap-2.0.md).

<br/>
<br/>

### 🗄️ — Archives & Genesis
## 🗄️ — Archives & Genesis

___

Expand All @@ -97,19 +84,17 @@ Mainnet is currently running as `cosmoshub-4`. Archives of the state of `cosmosh

If you are looking for historical genesis files and other data [`cosmos/mainnet`](http://github.com/cosmos/mainnet) is an excellent resource. Snapshots are also available at [cosmos.quicksync.io](https://cosmos.quicksync.io).

<br/>
<br/>

### 🤝 — How to contribute
## 🤝 — How to contribute

___

Check out [contributing.md](CONTRIBUTING.md) for our guidelines & policies for how we develop the Cosmos Hub. Thank you to all those who have contributed!

<br/>
<br/>

### 💬 — Talk to us
## 💬 — Talk to us

___

Expand All @@ -124,10 +109,9 @@ We have active, helpful communities on Twitter, Discord, and Telegram.

For updates on the Cosmos Hub team's activities follow us on the [Cosmos Hub Twitter](https://twitter.com/cosmoshub) account.

<br/>
<br/>

### 👏 — Supporters
## 👏 — Supporters

___

Expand Down
19 changes: 19 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
sonar.projectKey=cosmos_gaia
sonar.organization=cosmos

sonar.projectName=Gaia

sonar.sources=.
sonar.exclusions=**/*_test.go,tests/**,**/testutil/**,**/*.pb.go,**/*.pb.gw.go,test_helpers.go,docs/**,client/docs/**,contrib/**,
sonar.tests=.
sonar.test.inclusions=**/*_test.go,tests/**,**/testutil/**
sonar.go.coverage.reportPaths=coverage.out,*profile.out

sonar.python.version=3
sonar.sourceEncoding=UTF-8
sonar.scm.provider=git

# Exclude C/C++/Objective-C files from analysis
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-
14 changes: 0 additions & 14 deletions tools/tools.go

This file was deleted.

0 comments on commit 605e5db

Please sign in to comment.