feat: add identity function "id" in "Foo" contract

ci: separate jobs in workflow
This commit is contained in:
Paul Razvan Berg 2023-02-07 13:05:27 +02:00
parent d9208373a1
commit 4bd096541a
No known key found for this signature in database
GPG Key ID: BCC366159BD63828
2 changed files with 38 additions and 15 deletions

View File

@ -15,16 +15,11 @@ on:
- "main" - "main"
jobs: jobs:
ci: lint:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
- name: "Check out the repo" - name: "Check out the repo"
uses: "actions/checkout@v3" uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Install Foundry and restore the RPC cache, if any"
uses: "foundry-rs/foundry-toolchain@v1"
- name: "Install Node.js" - name: "Install Node.js"
uses: "actions/setup-node@v3" uses: "actions/setup-node@v3"
@ -40,13 +35,44 @@ jobs:
- name: "Add lint summary" - name: "Add lint summary"
run: | run: |
echo "## Lint" >> $GITHUB_STEP_SUMMARY echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
build:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
- name: "Build the contracts and print their size"
run: "forge build --sizes"
- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
test:
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
- name: "Show the Foundry config" - name: "Show the Foundry config"
run: "forge config" run: "forge config"
- name: "Generate fuzz seed that changes weekly to avoid burning through RPC allowance" - name: "Generate a fuzz seed that changes weekly to avoid burning through RPC allowance"
run: > run: >
echo "FOUNDRY_FUZZ_SEED=$( echo "FOUNDRY_FUZZ_SEED=$(
echo $(($EPOCHSECONDS - $EPOCHSECONDS % 604800)) echo $(($EPOCHSECONDS - $EPOCHSECONDS % 604800))
@ -55,12 +81,7 @@ jobs:
- name: "Run the tests" - name: "Run the tests"
run: "forge test" run: "forge test"
- name: "Check that the contracts are each under 24kB"
run: |
forge --version
forge build --sizes
- name: "Add test summary" - name: "Add test summary"
run: | run: |
echo "## Tests" >> $GITHUB_STEP_SUMMARY echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

View File

@ -2,5 +2,7 @@
pragma solidity >=0.8.18; pragma solidity >=0.8.18;
contract Foo { contract Foo {
// solhint-disable-previous-line no-empty-blocks function id(uint256 value) external pure returns (uint256) {
return value;
}
} }