From 71ceb22b0edca2db12553c6477ac29867a3a15bf Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 29 Apr 2026 16:33:33 +0400 Subject: [PATCH 1/7] Add matrix lint smoke examples --- .github/workflows/forge-lint.yml | 13 +++++++++++-- src/MixedCaseFunction.sol | 8 ++++++++ src/MixedCaseVariable.sol | 10 ++++++++++ src/ScreamingSnakeConstant.sol | 10 ++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/MixedCaseFunction.sol create mode 100644 src/MixedCaseVariable.sol create mode 100644 src/ScreamingSnakeConstant.sol diff --git a/.github/workflows/forge-lint.yml b/.github/workflows/forge-lint.yml index ea25b4d..fd6b119 100644 --- a/.github/workflows/forge-lint.yml +++ b/.github/workflows/forge-lint.yml @@ -3,19 +3,28 @@ name: Forge Lint on: pull_request: workflow_dispatch: + schedule: + - cron: "17 6 * * *" permissions: contents: read jobs: forge-lint: - name: Forge Lint + name: Forge Lint (${{ matrix.foundry-version }}) runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + foundry-version: + - v1.5.1 + - v1.7.0 + - stable steps: # actions/checkout v6.0.2 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: 0xJem/forge-lint-inline-action@2558c3a619002cd5857e73d750954f5e2248ee07 with: - foundry-version: stable + foundry-version: ${{ matrix.foundry-version }} fail-level: none diff --git a/src/MixedCaseFunction.sol b/src/MixedCaseFunction.sol new file mode 100644 index 0000000..8178eb2 --- /dev/null +++ b/src/MixedCaseFunction.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.30; + +contract mixed_case_function { + function get_balance() external pure returns (uint256) { + return 1 ether; + } +} diff --git a/src/MixedCaseVariable.sol b/src/MixedCaseVariable.sol new file mode 100644 index 0000000..7b40c32 --- /dev/null +++ b/src/MixedCaseVariable.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.30; + +contract mixed_case_variable { + uint256 public owner_balance = 1 ether; + + function read() external view returns (uint256) { + return owner_balance; + } +} diff --git a/src/ScreamingSnakeConstant.sol b/src/ScreamingSnakeConstant.sol new file mode 100644 index 0000000..e386ebc --- /dev/null +++ b/src/ScreamingSnakeConstant.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.30; + +contract screaming_snake_constant { + uint256 public constant ownerBalance = 1 ether; + + function read() external pure returns (uint256) { + return ownerBalance; + } +} From 44d0d47fe3765f781c87ee8b22e7502162f6a090 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 29 Apr 2026 16:36:59 +0400 Subject: [PATCH 2/7] Ignore forge build artifacts --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8a1d07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +cache/ +out/ From aeb313804090efa13fc60d7c6fd012899143f146 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 29 Apr 2026 16:45:25 +0400 Subject: [PATCH 3/7] Require smoke test annotations --- .github/workflows/forge-lint.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/forge-lint.yml b/.github/workflows/forge-lint.yml index fd6b119..2a14b48 100644 --- a/.github/workflows/forge-lint.yml +++ b/.github/workflows/forge-lint.yml @@ -7,6 +7,7 @@ on: - cron: "17 6 * * *" permissions: + checks: read contents: read jobs: @@ -28,3 +29,33 @@ jobs: with: foundry-version: ${{ matrix.foundry-version }} fail-level: none + + - name: Require annotations + env: + GH_TOKEN: ${{ github.token }} + JOB_NAME: Forge Lint (${{ matrix.foundry-version }}) + run: | + set -euo pipefail + + check_run_id="$( + gh api "/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/check-runs" \ + --jq ".check_runs[] | select(.name == env.JOB_NAME) | .id" \ + | head -n 1 + )" + + if [ -z "$check_run_id" ]; then + echo "::error::Could not find check run for ${JOB_NAME}" + exit 1 + fi + + annotation_count="$( + gh api "/repos/${GITHUB_REPOSITORY}/check-runs/${check_run_id}/annotations" \ + --jq "length" + )" + + if [ "$annotation_count" -eq 0 ]; then + echo "::error::Expected at least one Forge lint annotation for ${JOB_NAME}" + exit 1 + fi + + echo "Found ${annotation_count} Forge lint annotation(s) for ${JOB_NAME}" From ebd12d7aa9c34d0913b4bf740bbc3cca2cc8e38a Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 29 Apr 2026 16:49:50 +0400 Subject: [PATCH 4/7] Find smoke annotations by workflow job --- .github/workflows/forge-lint.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/forge-lint.yml b/.github/workflows/forge-lint.yml index 2a14b48..c3bef59 100644 --- a/.github/workflows/forge-lint.yml +++ b/.github/workflows/forge-lint.yml @@ -7,6 +7,7 @@ on: - cron: "17 6 * * *" permissions: + actions: read checks: read contents: read @@ -38,8 +39,8 @@ jobs: set -euo pipefail check_run_id="$( - gh api "/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/check-runs" \ - --jq ".check_runs[] | select(.name == env.JOB_NAME) | .id" \ + gh api "/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs" \ + --jq ".jobs[] | select(.name == env.JOB_NAME) | .id" \ | head -n 1 )" From dfcab52d0a161c74883f725871d8df2fe803a2ef Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 29 Apr 2026 16:56:18 +0400 Subject: [PATCH 5/7] Check smoke annotations after matrix jobs --- .github/workflows/forge-lint.yml | 50 ++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/.github/workflows/forge-lint.yml b/.github/workflows/forge-lint.yml index c3bef59..9c084d7 100644 --- a/.github/workflows/forge-lint.yml +++ b/.github/workflows/forge-lint.yml @@ -31,32 +31,44 @@ jobs: foundry-version: ${{ matrix.foundry-version }} fail-level: none + require-annotations: + name: Require annotations + runs-on: ubuntu-latest + needs: forge-lint + if: always() + steps: - name: Require annotations env: GH_TOKEN: ${{ github.token }} - JOB_NAME: Forge Lint (${{ matrix.foundry-version }}) run: | set -euo pipefail - check_run_id="$( - gh api "/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs" \ - --jq ".jobs[] | select(.name == env.JOB_NAME) | .id" \ - | head -n 1 - )" + failed=0 + for version in v1.5.1 v1.7.0 stable; do + job_name="Forge Lint (${version})" + check_run_id="$( + gh api "/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs" \ + --jq ".jobs[] | select(.name == \"${job_name}\") | .id" \ + | head -n 1 + )" - if [ -z "$check_run_id" ]; then - echo "::error::Could not find check run for ${JOB_NAME}" - exit 1 - fi + if [ -z "$check_run_id" ]; then + echo "::error::Could not find check run for ${job_name}" + failed=1 + continue + fi - annotation_count="$( - gh api "/repos/${GITHUB_REPOSITORY}/check-runs/${check_run_id}/annotations" \ - --jq "length" - )" + annotation_count="$( + gh api "/repos/${GITHUB_REPOSITORY}/check-runs/${check_run_id}/annotations" \ + --jq "length" + )" - if [ "$annotation_count" -eq 0 ]; then - echo "::error::Expected at least one Forge lint annotation for ${JOB_NAME}" - exit 1 - fi + if [ "$annotation_count" -eq 0 ]; then + echo "::error::Expected at least one Forge lint annotation for ${job_name}" + failed=1 + else + echo "Found ${annotation_count} Forge lint annotation(s) for ${job_name}" + fi + done - echo "Found ${annotation_count} Forge lint annotation(s) for ${JOB_NAME}" + exit "$failed" From f9707d8ee53b98fe90d59e48e3eb27f8b313b308 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 29 Apr 2026 16:59:22 +0400 Subject: [PATCH 6/7] Run smoke workflow at midnight UTC --- .github/workflows/forge-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/forge-lint.yml b/.github/workflows/forge-lint.yml index 9c084d7..382f231 100644 --- a/.github/workflows/forge-lint.yml +++ b/.github/workflows/forge-lint.yml @@ -4,7 +4,7 @@ on: pull_request: workflow_dispatch: schedule: - - cron: "17 6 * * *" + - cron: "0 0 * * *" permissions: actions: read From 1af5037122d87685f26b3ce5d648de61fff23a8a Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 29 Apr 2026 17:01:23 +0400 Subject: [PATCH 7/7] Enable all smoke lint severities --- foundry.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/foundry.toml b/foundry.toml index 1d3757c..0b19a05 100644 --- a/foundry.toml +++ b/foundry.toml @@ -3,3 +3,6 @@ src = "src" out = "out" libs = ["lib"] solc_version = "0.8.30" + +[lint] +severity = ["high", "medium", "low", "info", "gas", "code-size"]