-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linting and Code Scanning #178
Changes from all commits
90a35df
47ab0e8
2139232
d93ed17
7f5a812
ae71640
22c3f0b
2b3d4ad
0f4801e
b24e0f1
8eaa482
7df67ad
c0a39b8
8976a08
10f5276
a6c236a
037da31
0c60902
b4e90b0
ff2db17
f9e7593
56aca2e
b86f44f
0c40315
a7b995e
2d3f4c9
b439a8d
1c691ca
008a420
a224fce
e587a9d
0b719b6
ae3ef18
e6641c4
2cde9cb
3159333
6041881
a4b8092
955cccb
3184df5
6e7bbca
1db0047
5c41ee2
4f560fa
f80a5d8
ea3827c
794fcdf
32b914f
3faec01
5bd485b
16a49d4
2e6dbd3
9167f92
a520f9b
5040427
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
version: 2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my other comment about dependabot |
||
updates: | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: gomod | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
ignore: | ||
- dependency-name: github.com/CosmWasm/wasmvm | ||
versions: | ||
- 0.14.0-beta2 | ||
- 0.14.0-beta3 | ||
- 0.14.0-beta4 | ||
- 0.14.0-beta5 | ||
- 0.14.0-rc1 | ||
- dependency-name: github.com/cosmos/cosmos-sdk | ||
versions: | ||
- 0.41.4 | ||
- 0.42.0 | ||
- 0.42.1 | ||
- 0.42.2 | ||
- 0.42.4 | ||
- dependency-name: google.golang.org/grpc | ||
versions: | ||
- 1.36.0 | ||
- 1.36.1 | ||
- 1.37.0 | ||
- dependency-name: github.com/spf13/cobra | ||
versions: | ||
- 1.1.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are in the process of building a new CI/CD pipeline. So most of the assets will most likely end up being deprecated |
||
on: [push, pull_request] | ||
name: Build | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: build | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.20" | ||
- run: go build ./... | ||
|
||
tidy: | ||
runs-on: ubuntu-latest | ||
name: tidy | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.20" | ||
- run: | | ||
go mod tidy | ||
CHANGES_IN_REPO=$(git status --porcelain) | ||
if [[ -n "$CHANGES_IN_REPO" ]]; then | ||
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" | ||
git status && git --no-pager diff | ||
exit 1 | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# This workflow checks out code, performs a Codacy security scan | ||
# and integrates the results with the | ||
# GitHub Advanced Security code scanning feature. For more information on | ||
# the Codacy security scan action usage and parameters, see | ||
# https://github.com/codacy/codacy-analysis-cli-action. | ||
# For more information on Codacy Analysis CLI in general, see | ||
# https://github.com/codacy/codacy-analysis-cli. | ||
|
||
name: Codacy Security Scan | ||
|
||
on: | ||
push: | ||
branches: [ "main", "release/v*" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "main", "release/v*" ] | ||
schedule: | ||
- cron: '24 14 * * 5' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
codacy-security-scan: | ||
permissions: | ||
contents: read # for actions/checkout to fetch code | ||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | ||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | ||
name: Codacy Security Scan | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout the repository to the GitHub Actions runner | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis | ||
- name: Run Codacy Analysis CLI | ||
uses: codacy/codacy-analysis-cli-action@d43127fe38d20c527dc1951ae5aea23148bab738 | ||
with: | ||
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository | ||
# You can also omit the token and run the tools that support default configurations | ||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
verbose: true | ||
output: results.sarif | ||
format: sarif | ||
# Adjust severity of non-security issues | ||
gh-code-scanning-compat: true | ||
# Force 0 exit code to allow SARIF file generation | ||
# This will handover control about PR rejection to the GitHub side | ||
max-allowed-issues: 2147483647 | ||
|
||
# Upload the SARIF file generated in the previous step | ||
- name: Upload SARIF results file | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: results.sarif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: "Code Scanning - Action" | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "**.go" | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- "**.go" | ||
|
||
jobs: | ||
CodeQL-Build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3.3.0 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: 'go' | ||
queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality | ||
|
||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: "CodeQL for cosmos" | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "**.go" | ||
push: | ||
branches: | ||
- main | ||
- release/v* | ||
paths: | ||
- "**.go" | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.20" | ||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: "go" | ||
queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality | ||
|
||
- name: Build | ||
run: make build | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Dependency Review Action | ||
# | ||
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. | ||
# | ||
# Source repository: https://github.com/actions/dependency-review-action | ||
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement | ||
name: 'Dependency Review' | ||
on: [pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
dependency-review: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout Repository' | ||
uses: actions/checkout@v3 | ||
- name: 'Dependency Review' | ||
uses: actions/dependency-review-action@v3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,23 @@ | ||
name: Build & Push | ||
# Build & Push builds the simapp docker image on every push to master and | ||
# and pushes the image to https://hub.docker.com/r/interchainio/simapp/tags | ||
--- | ||
name: Build Docker Image on PR | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
- "release/*" | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 | ||
|
||
jobs: | ||
build: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Prepare | ||
id: prep | ||
run: | | ||
DOCKER_IMAGE=terramoney/core | ||
VERSION=noop | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
elif [[ $GITHUB_REF == refs/heads/* ]]; then | ||
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') | ||
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then | ||
VERSION=latest | ||
fi | ||
fi | ||
TAGS="${DOCKER_IMAGE}:${VERSION}" | ||
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | ||
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION}" | ||
fi | ||
echo ::set-output name=version::${VERSION} | ||
echo ::set-output name=tags::${TAGS} | ||
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish to Docker Hub | ||
- name: Build without push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: ${{ github.event_name != 'pull_request' && !contains(github.ref, 'release') }} | ||
tags: ${{ steps.prep.outputs.tags }} | ||
context: . | ||
platforms: linux/amd64 | ||
push: false | ||
build-args: arch=x86_64 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: golangci-lint | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- release/v* | ||
- main | ||
pull_request: | ||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.20" | ||
- uses: actions/checkout@v3 | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
args: --timeout 10m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need any bot watching for CometBFT deps. CometBFT is not (yet) part of our Classic codebase...