Skip to content
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

feat: scope the CI and add QoL improvements #3316

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 53 additions & 4 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ codecov:
wait_for_ci: true

comment:
require_changes: false
require_changes: true

coverage:
round: down
Expand All @@ -13,7 +13,7 @@ coverage:
project:
default:
target: auto
threshold: 10 # Let's decrease this later.
threshold: 5 # Let's decrease this later.
base: parent
if_no_uploads: error
if_not_found: success
Expand All @@ -22,12 +22,12 @@ coverage:
patch:
default:
target: auto
threshold: 10 # Let's decrease this later.
threshold: 5 # Let's decrease this later.
base: auto
if_no_uploads: error
if_not_found: success
if_ci_failed: error
only_pulls: false
only_pulls: true # Only check patch coverage on PRs

flag_management:
default_rules:
Expand All @@ -40,6 +40,55 @@ flag_management:
target: auto # Let's decrease this later.
threshold: 10

groups:
gno-land:
paths:
- "gno.land/**"
flags:
- gno-land
gnovm:
paths:
- "gnovm/**"
flags:
- gnovm
misc:
paths:
- "misc/**"
flags:
- misc
tm2:
paths:
- "tm2/**"
flags:
- tm2
contribs:
paths:
- "contribs/**"
flags:
- contribs
Comment on lines +43 to +68
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flags are already automatically defined here: https://github.com/gnolang/gno/pull/3316/files#diff-a8d8d916d02d13f09d2a0128a4667158fdd150a4e354d0c7a9cde6a8479b3dc5R68 so no need to define them here.


statuses:
- type: project
flag: gno-land
target: auto
threshold: 5
- type: project
flag: gnovm
target: auto
threshold: 2 # Stricter threshold
- type: project
flag: misc
target: auto
threshold: 10
- type: project
flag: tm2
target: auto
threshold: 5
- type: project
flag: contribs
target: auto
threshold: 5
Comment on lines +70 to +90
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we want to change thresholds depending on the flag? Is it really necessary?


ignore:
- "gnovm/stdlibs/generated.go"
- "gnovm/tests/stdlibs/generated.go"
Expand Down
7 changes: 6 additions & 1 deletion .github/golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ linters:
linters-settings:
gofmt:
simplify: true

goconst:
min-len: 3
min-occurrences: 3

gosec:
excludes:
- G204 # Subprocess launched with a potential tainted input or cmd arguments
Expand All @@ -56,24 +58,27 @@ linters-settings:
checks: [ "all", "-ST1022", "-ST1003" ]
errorlint:
asserts: false

gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style

forbidigo:
forbid:
- p: '^regexp\.(Match|MatchString)$'
msg: it will re-compile the regexp for each execution; compile the regexp with regexp.Compile and store it as a singleton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc the error message came out better written out (in context) as I wrote it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd/gno/main.go:26:2: use of `regexp.MatchString` forbidden because "it will re-compile the regexp for each execution; compile the regexp with regexp.Compile and store it as a singleton" (forbidigo)

msg: "Use compiled regex via regexp.Compile and store as a singleton"

issues:
whole-files: true
max-issues-per-linter: 0
max-same-issues: 0
new: false
fix: false

exclude-rules:
- path: _test\.go
linters:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-author-assign.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: auto-author-assign
name: Auto Assign PR Author

on:
pull_request_target:
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/autocounterd.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we test building it?

do we use it in any deployment?

Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
name: autocounterd
name: Portal Loop - autocounterd

on:
pull_request:
branches:
- master
push:
branches:
- "master"
paths:
- misc/autocounterd
- misc/loop
- .github/workflows/autocounterd.yml
branches:
- "master"
- "misc/autocounterd"
tags:
- "v*"

permissions:
contents: read
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/benchmark-master-push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: run benchmarks when pushing on main branch
name: Run and Save Benchmarks

on:
push:
Expand All @@ -9,6 +9,7 @@ on:
- gno.land/**
- gnovm/**
- tm2/**
- '**/*.go'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is making previous filters unnecessary.

permissions:
# deployments permission to deploy GitHub pages website
Expand All @@ -22,7 +23,7 @@ env:
jobs:
benchmarks:
if: ${{ github.repository == 'gnolang/gno' }}
runs-on: [self-hosted, Linux, X64, benchmarks]
runs-on: [ self-hosted, Linux, X64, benchmarks ]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
68 changes: 34 additions & 34 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: CodeQL

on:
push:
Expand Down Expand Up @@ -41,8 +41,8 @@ jobs:
fail-fast: false
matrix:
include:
- language: go
build-mode: autobuild
- language: go
build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
Expand All @@ -52,38 +52,38 @@ jobs:
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
13 changes: 8 additions & 5 deletions .github/workflows/contribs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: contribs
name: Contribs CI Suite

on:
push:
branches:
- master
workflow_dispatch:
pull_request:
paths:
- contribs/**
workflow_dispatch:

jobs:
setup:
Expand All @@ -19,12 +21,13 @@ jobs:
main:
needs: setup
strategy:
fail-fast: false
matrix:
program: ${{ fromJson(needs.setup.outputs.programs) }}
fail-fast: false
matrix:
program: ${{ fromJson(needs.setup.outputs.programs) }}
name: Run Main
uses: ./.github/workflows/main_template.yml
with:
modulepath: contribs/${{ matrix.program }}
go-version: "1.22.x"
secrets:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving go version outside the main template is making it scattered around more than before...

codecov-token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/dependabot-validate.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: dependabot validate
name: Validate Dependabot Config

on:
pull_request:
paths:
- '.github/dependabot.yml'
- '.github/workflows/dependabot-validate.yml'

jobs:
validate:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: deploy docs on gnolang/docs.gno.land repository
# This workflow triggers a cross-repo workflow call,
# that deploys the monorepo docs on Netlify, using Docusaurus
name: Deploy the Documentation
on:
push:
branches:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "docs / lint"
name: Docs Linter

on:
push:
paths:
branches:
- master
pull_request:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

paths:
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: examples
name: Gno Examples CI Suite

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this one short; "CI suite" is redundant.

I like "Test Examples"

on:
pull_request:
push:
branches: ["master"]
branches:
- master
pull_request:
paths:
- gnovm/**/*.gno
- examples/**/*.gno

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -67,26 +71,23 @@ jobs:
# TODO: consider running lint on every other directories, maybe in "warning" mode?
# TODO: track coverage
fmt:
strategy:
fail-fast: false
matrix:
goversion: ["1.22.x"]
name: Run gno fmt
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- name: gno fmt
uses: ./.github/workflows/gnofmt_template.yml
with:
go-version: ${{ matrix.goversion }}
- run: |
make fmt -C ./examples
# Check if there are changes after running make fmt
path: "examples/..."
go-version: "1.22.x"
- name: Check for unformatted gno files
run: |
git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1)

mod-tidy:
strategy:
fail-fast: false
matrix:
go-version: ["1.22.x"]
go-version: [ "1.22.x" ]
# unittests: TODO: matrix with contracts
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
Loading
Loading