forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add relevant workflows (backport ethereum#1) (ethereum#11)
Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>
- Loading branch information
1 parent
e5eb32a
commit 2c4391f
Showing
8 changed files
with
273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
cleanup-runs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: rokroskar/workflow-run-cleanup-action@master | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
check-latest: true | ||
- uses: technote-space/get-diff-action@v6.1.2 | ||
id: git_diff | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
- run: | | ||
make build | ||
if: env.GIT_DIFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: "Dependency Review" | ||
on: pull_request | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
dependency-review: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
check-latest: true | ||
- name: "Checkout Repository" | ||
uses: actions/checkout@v3 | ||
- uses: technote-space/get-diff-action@v6.1.2 | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
- name: "Dependency Review" | ||
uses: actions/dependency-review-action@v3 | ||
if: env.GIT_DIFF | ||
- name: "Go vulnerability check" | ||
run: make vulncheck | ||
if: env.GIT_DIFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Lint | ||
# Lint runs golangci-lint over the entire ethermint repository This workflow is | ||
# run on every pull request and push to main The `golangci` will pass without | ||
# running if no *.{go, mod, sum} files have been changed. | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
golangci: | ||
name: Run golangci-lint | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
# Required: setup-go, for all versions v3.0.0+ of golangci-lint | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
check-latest: true | ||
- uses: actions/checkout@v3 | ||
- uses: technote-space/get-diff-action@v6.1.2 | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
- uses: golangci/golangci-lint-action@v3.3.1 | ||
with: | ||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | ||
version: latest | ||
args: --timeout 10m | ||
github-token: ${{ secrets.github_token }} | ||
# Check only if there are differences in the source code | ||
if: env.GIT_DIFF | ||
markdown-lint: | ||
name: Run markdown-lint | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: technote-space/get-diff-action@v6.1.2 | ||
with: | ||
PATTERNS: | | ||
docs/**/*.md | ||
x/**/*.md | ||
README.md | ||
- uses: nosborn/github-action-markdown-cli@v3.2.0 | ||
with: | ||
files: . | ||
config_file: .markdownlint.yml | ||
ignore_path: .markdownlintignore | ||
# Check only if there are differences in the source code | ||
if: env.GIT_DIFF | ||
gomod2nix: | ||
name: Check gomod2nix.toml file is up to date | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2.3.4 | ||
- uses: cachix/install-nix-action@v18 | ||
- uses: cachix/cachix-action@v12 | ||
with: | ||
name: ethermint | ||
- uses: technote-space/get-diff-action@v6.1.2 | ||
with: | ||
PATTERNS: | | ||
**/**.py | ||
- name: run gomod2nix | ||
run: | | ||
nix run -f ./nix gomod2nix | ||
git diff --no-ext-diff --exit-code | ||
if: env.GIT_DIFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Check Markdown links | ||
on: | ||
pull_request: | ||
paths: | ||
- '**.md' | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.md' | ||
|
||
jobs: | ||
markdown-link-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: technote-space/get-diff-action@v6.1.2 | ||
id: git_diff | ||
with: | ||
PATTERNS: | | ||
**/**.md | ||
- uses: gaurav-nelson/github-action-markdown-link-check@master | ||
with: | ||
folder-path: "docs" | ||
check-modified-files-only: "yes" | ||
use-quiet-mode: "yes" | ||
base-branch: "main" | ||
config-file: "mlc_config.json" | ||
if: env.GIT_DIFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Run Gosec | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
Gosec: | ||
permissions: | ||
security-events: write | ||
|
||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: on | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v3 | ||
- name: Get Diff | ||
uses: technote-space/get-diff-action@v6.1.2 | ||
with: | ||
PATTERNS: | | ||
**/*.go | ||
go.mod | ||
go.sum | ||
- name: Run Gosec Security Scanner | ||
uses: cosmos/gosec@master | ||
with: | ||
# we let the report trigger content trigger a failure using the GitHub Security features. | ||
args: "-no-fail -fmt sarif -out results.sarif ./..." | ||
if: "env.GIT_DIFF_FILTERED != ''" | ||
- name: Upload SARIF file | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
# Path to SARIF file relative to the root of the repository | ||
sarif_file: results.sarif | ||
if: "env.GIT_DIFF_FILTERED != ''" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This workflow executes several linters on changed files based on languages used in your code base whenever | ||
# you push a code or open a pull request. | ||
# | ||
# You can adjust the behavior by modifying this file. | ||
# For more information, see: | ||
# https://github.com/github/super-linter | ||
--- | ||
name: Lint Code Base | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
jobs: | ||
run-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
# Full git history is needed to get a proper list of changed files within `super-linter` | ||
fetch-depth: 0 | ||
|
||
- name: Lint Code Base | ||
uses: github/super-linter@v4 | ||
env: | ||
LINTER_RULES_PATH: / | ||
YAML_CONFIG_FILE: .yamllint | ||
VALIDATE_ALL_CODEBASE: false | ||
MARKDOWN_CONFIG_FILE: .markdownlint.yml | ||
PROTOBUF_CONFIG_FILE: .protolint.yml | ||
VALIDATE_NATURAL_LANGUAGE: false | ||
VALIDATE_OPENAPI: false | ||
VALIDATE_JSCPD: false | ||
VALIDATE_GO: false | ||
DEFAULT_BRANCH: "master" | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Tests | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- release/** | ||
|
||
jobs: | ||
cleanup-runs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: rokroskar/workflow-run-cleanup-action@master | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'" | ||
|
||
test-all: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
check-latest: true | ||
- uses: actions/checkout@v3 | ||
- uses: technote-space/get-diff-action@v6.1.2 | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
- name: Test and Create Coverage Report | ||
run: | | ||
make test all | ||
if: env.GIT_DIFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters