Skip to content

Commit

Permalink
Merge branch 'master' into fix/2628
Browse files Browse the repository at this point in the history
  • Loading branch information
omarsy authored Dec 27, 2024
2 parents 4da7934 + 3fd5571 commit 6ef45d4
Show file tree
Hide file tree
Showing 402 changed files with 19,336 additions and 6,169 deletions.
8 changes: 8 additions & 0 deletions .github/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Make sure this is the top-level editorconfig
# https://editorconfig.org/
root = true

# GitHub Actions Workflows
[workflows/**.yml]
indent_style = space
indent_size = 2
8 changes: 4 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 Down
5 changes: 5 additions & 0 deletions .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,13 +58,15 @@ linters-settings:
checks: [ "all", "-ST1022", "-ST1003" ]
errorlint:
asserts: false

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

forbidigo:
forbid:
- p: '^regexp\.(Match|MatchString)$'
Expand All @@ -74,6 +78,7 @@ issues:
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
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
12 changes: 6 additions & 6 deletions .github/workflows/benchmark-master-push.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: run benchmarks when pushing on main branch
name: Run and Save Benchmarks

on:
push:
branches:
- master
paths:
- contribs/**
- gno.land/**
- gnovm/**
- tm2/**
- contribs/**/*.go
- gno.land/**/*.go
- gnovm/**/*.go
- tm2/**/*.go

permissions:
# deployments permission to deploy GitHub pages website
Expand All @@ -22,7 +22,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
48 changes: 48 additions & 0 deletions .github/workflows/bot-proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow must be kept in sync to some extent with bot.yml
name: GitHub Bot Proxy

on:
# Watch for any completed run on bot.yml workflow
workflow_run:
workflows: [GitHub Bot]
types: [completed]

jobs:
# This workflow monitors any run completed on the GitHub Bot workflow and
# checks if the event that triggered it is limited to read-only permissions
# (e.g 'pull_request_review' on a pull request opened from a fork).
# In this case, it reruns the GitHub Bot workflow using a 'workflow_dispatch'
# event, thereby allowing it to run with write permissions.
#
# Complete flow:
# 'pull_request_review' from fork on bot.yml (read-only) -> 'workflow_run' on bot-proxy.yml (write) -> 'workflow_dispatch' on bot.yml (write)
rerun-with-write-perm:
name: Rerun Bot with write permission
# Skip this workflow if the original event is not 'pull_request_review'
if: github.event.workflow_run.event == 'pull_request_review'
runs-on: ubuntu-latest
permissions:
actions: write

steps:
- name: Download artifact from previous run
uses: actions/download-artifact@v4
with:
name: pr-number
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
# Even if the artifact doesn't exist, do not mark the workflow as failed
# Useful if the 'pull_request_review' event was emitted by a PR opened
# from a branch on the main repo, so it has already been processed by
# the bot workflow, and no artifact has been uploaded.
continue-on-error: true
id: download

- name: Send workflow_dispatch event to Github Bot
# Run only if an artifact was downloaded
if: steps.download.outcome == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.event.workflow_run.repository.full_name }}
run: |
gh workflow run bot.yml -R "$REPO" -f "pull-request-list=$(cat pr-number)"
36 changes: 33 additions & 3 deletions .github/workflows/bot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This workflow must be kept in sync to some extent with bot-proxy.yml
name: GitHub Bot

on:
Expand Down Expand Up @@ -37,8 +38,14 @@ jobs:
# handle the parallel processing of the pull-requests
define-prs-matrix:
name: Define PRs matrix
# Prevent bot from retriggering itself and ignore event emitted by codecov
if: ${{ github.actor != vars.GH_BOT_LOGIN && github.actor != 'codecov[bot]' }}
# Skip this workflow if:
# - the bot is retriggering itself
# - the event is emitted by codecov
# - the event is a review on a pull request from a fork (see save-pr-number job below)
if: |
github.actor != vars.GH_BOT_LOGIN &&
github.actor != 'codecov[bot]' &&
(github.event_name != 'pull_request_review' || github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name)
runs-on: ubuntu-latest
permissions:
pull-requests: read
Expand All @@ -61,13 +68,36 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: go run . matrix -matrix-key 'pr-numbers' -verbose

# This job is executed if an event with read-only permission has triggered this
# workflow (e.g 'pull_request_review' on a pull request opened from a fork).
# In this case, this job persists the PR number in an artifact so that the
# proxy workflow can use it to rerun the current workflow with write permission.
# See bot-proxy.yml for more info.
save-pr-number:
name: Persist PR number for proxy
# Run this job if the event is a review on a pull request opened from a fork
if: github.event_name == 'pull_request_review' && github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name
runs-on: ubuntu-latest

steps:
- name: Write PR number to a file
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: echo $PR_NUMBER > pr-number

- name: Upload it as an artifact
uses: actions/upload-artifact@v4
with:
name: pr-number
path: pr-number

# This job processes each pull request in the matrix individually while ensuring
# that a same PR cannot be processed concurrently by mutliple runners
process-pr:
name: Process PR
needs: define-prs-matrix
# Just skip this job if PR numbers matrix is empty (prevent failed state)
if: ${{ needs.define-prs-matrix.outputs.pr-numbers != '[]' && needs.define-prs-matrix.outputs.pr-numbers != '' }}
if: needs.define-prs-matrix.outputs.pr-numbers != '[]' && needs.define-prs-matrix.outputs.pr-numbers != ''
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
72 changes: 38 additions & 34 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: CodeQL

on:
push:
branches: [ "master", "chain/*" ]
pull_request:
branches: [ "master", "chain/*" ]
paths:
- '**/*.go'
- 'go.mod'
- 'go.sum'
schedule:
- cron: '22 17 * * 3'

Expand All @@ -41,8 +45,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 +56,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}}"
Loading

0 comments on commit 6ef45d4

Please sign in to comment.