From 1ab143f99a07295ee0d6578eab9f1d196487107a Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Wed, 27 Apr 2022 16:58:12 +0300 Subject: [PATCH 1/4] ci: add slither --- .github/workflows/ci.yml | 2 +- .github/workflows/lint.yml | 40 ++++++++++++++++++++++++++++++++++++++ README.md | 3 ++- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbe7307..ccaec61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: Foundry Tests on: push: branches: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..44c2385 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,40 @@ +name: Lint +on: + push: + branches: + - master + pull_request: + +jobs: + run-ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Install deps + run: forge install + + - name: Build contracts + run: forge build + + - name: Run Slither + uses: crytic/slither-action@v0.1.1 + id: slither + continue-on-error: true + with: + # foundry-rs/foundry-toolchain@v1 will install foundry outside of the slither-action container. + # As a result, we need to run `forge build` before running slither, and then run slither with + # `ignore-compile: true` + # The action might eventually package Foundry: https://github.com/crytic/slither-action/issues/5 + ignore-compile: true + sarif: results.sarif + + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v1 + with: + sarif_file: ${{ steps.slither.outputs.sarif }} diff --git a/README.md b/README.md index efac030..2644b2d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ **Template repository for getting started quickly with Foundry projects** -![Github Actions](https://github.com/foundry-rs/forge-template/workflows/CI/badge.svg) +![Foundry Tests](https://github.com/foundry-rs/forge-template/workflows/Foundry Tests/badge.svg) +![Slither Lints](https://github.com/foundry-rs/forge-template/workflows/Lints/badge.svg) ## Getting Started From c268b321d98360165bc082f1e3c5ead8bef6f4a9 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Thu, 28 Apr 2022 11:43:36 +0300 Subject: [PATCH 2/4] bump forge-std --- lib/forge-std | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/forge-std b/lib/forge-std index 40977d9..409465b 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 40977d9e9444acd4c59c16b6782c658c786c0d05 +Subproject commit 409465b6992822a91318142dd269660aad9e30ee From ff2cb5d6691fdcf40aaef1669026a6f8b620e0f6 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Mon, 9 May 2022 10:25:10 -0700 Subject: [PATCH 3/4] ci: use slither with native forge build https://github.com/crytic/slither-action/pull/8 --- .github/workflows/lint.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 44c2385..0bd4bb2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,11 +19,8 @@ jobs: - name: Install deps run: forge install - - name: Build contracts - run: forge build - - name: Run Slither - uses: crytic/slither-action@v0.1.1 + uses: crytic/slither-action@dev-install-foundry id: slither continue-on-error: true with: From 36f0bf7cbc953f071027a1c1783e7e5c7d9613ed Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Thu, 12 May 2022 13:43:42 -0700 Subject: [PATCH 4/4] ci: use latest slither action --- .github/workflows/lint.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0bd4bb2..bb79edc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,15 +20,10 @@ jobs: run: forge install - name: Run Slither - uses: crytic/slither-action@dev-install-foundry + uses: crytic/slither-action@main id: slither continue-on-error: true with: - # foundry-rs/foundry-toolchain@v1 will install foundry outside of the slither-action container. - # As a result, we need to run `forge build` before running slither, and then run slither with - # `ignore-compile: true` - # The action might eventually package Foundry: https://github.com/crytic/slither-action/issues/5 - ignore-compile: true sarif: results.sarif - name: Upload SARIF file