Skip to content

Commit

Permalink
imp: add codecov ci
Browse files Browse the repository at this point in the history
  • Loading branch information
crodriguezvega committed Sep 10, 2024
1 parent ee85ba6 commit 5ea9100
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 36 deletions.
56 changes: 22 additions & 34 deletions .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "foundry"
name: foundry

env:
API_KEY_ALCHEMY: ${{ secrets.API_KEY_ALCHEMY }}
Expand All @@ -16,17 +16,8 @@ jobs:
name: "lint"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v2"

- name: "Install the Node.js dependencies"
run: "bun install"
- name: "Set up environment"
uses: ./.github/workflows/setup.yml

- name: "Lint the code"
run: "bun run lint:sol"
Expand All @@ -40,17 +31,8 @@ jobs:
name: "build"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v2"

- name: "Install the Node.js dependencies"
run: "bun install"
- name: "Set up environment"
uses: ./.github/workflows/setup.yml

- name: "Build the contracts and print their size"
run: "forge build --sizes"
Expand All @@ -65,17 +47,8 @@ jobs:
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v2"

- name: "Install the Node.js dependencies"
run: "bun install"
- name: "Set up environment"
uses: ./.github/workflows/setup.yml

- name: "Show the Foundry config"
run: "forge config"
Expand All @@ -93,3 +66,18 @@ jobs:
run: |
echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
coverage:
name: "coverage"
needs: ["test"]
runs-on: "ubuntu-latest"
steps:
- name: "Set up environment"
uses: ./.github/workflows/setup.yml

- name: "Run coverage"
run: "bun test:coverage:ci"

- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: setup

runs:
using: composite
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v2"
- name: "Install the Node.js dependencies"
run: "bun install"
4 changes: 2 additions & 2 deletions e2e/interchaintestv8/ibc_eureka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (s *IbcEurekaTestSuite) SetupSuite(ctx context.Context) {
case testvalues.EnvValueSp1Prover_Mock:
stdout, stderr, err = eth.ForgeScript(ctx, s.deployer.KeyName(), ethereum.ForgeScriptOpts{
ContractRootDir: ".",
SolidityContract: "script/MockE2ETestDeploy.s.sol",
SolidityContract: "scripts/MockE2ETestDeploy.s.sol",
RawOptions: []string{
"--json",
"--sender", s.deployer.FormattedAddress(), // This, combined with the keyname, makes msg.sender the deployer
Expand All @@ -167,7 +167,7 @@ func (s *IbcEurekaTestSuite) SetupSuite(ctx context.Context) {

stdout, stderr, err = eth.ForgeScript(ctx, s.deployer.KeyName(), ethereum.ForgeScriptOpts{
ContractRootDir: ".",
SolidityContract: "script/E2ETestDeploy.s.sol",
SolidityContract: "scripts/E2ETestDeploy.s.sol",
RawOptions: []string{
"--json",
"--sender", s.deployer.FormattedAddress(), // This, combined with the keyname, makes msg.sender the deployer
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"scripts": {
"lint:sol": "forge fmt --check && bun solhint -w 0 '{script,src,test}/**/*.sol' && bun natspec-smells --include 'src/**/*.sol'",
"test:coverage": "forge coverage",
"test:coverage:ci": "scripts/checks/coverage.sh",
"test:coverage:report": "forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions scripts/checks/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -euo pipefail

# Foundry coverage
forge coverage --report lcov
# Remove zero hits
sed -i '/,0/d' lcov.info

# Reports are then uploaded to Codecov automatically by workflow, and merged.

0 comments on commit 5ea9100

Please sign in to comment.