Skip to content

Commit

Permalink
Merge pull request #1 from ProjectOpenSea/dan/2023/10/test-ci
Browse files Browse the repository at this point in the history
test ci
  • Loading branch information
DJViau authored Oct 23, 2023
2 parents 99bf0c9 + 60180e1 commit 64f9ed9
Show file tree
Hide file tree
Showing 16 changed files with 238 additions and 180 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Github Actions automatically updated formatting with forge fmt\n72f425f1c2be0f568f8da002e469c9808bf41759
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
Borrowed from foundry.
Thank you for your Pull Request. Please provide a description above and review
the requirements below.
Bug fixes and new features should include tests.
-->

## Motivation

<!--
Explain the context and why you're making that change. What is the problem
you're trying to solve? In some cases there is not a problem and this can be
thought of as being the motivation for your change.
If your PR solves a particular issue, tag that issue.
-->

## Solution

<!--
Summarize the solution and provide any necessary context needed to understand
the code change.
-->
55 changes: 55 additions & 0 deletions .github/workflows/fix-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Autofix Linting

on:
issue_comment:
types: [created]

# Down scope as necessary via https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
checks: write
contents: write
pull-requests: write

jobs:
run-linters:
name: Run linters
if: github.event.issue.pull_request && ${{ github.event.comment.body == '!fix' }}
runs-on: ubuntu-latest

steps:
- name: GetBranch
id: 'get-branch'
run: echo ::set-output name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName')
env:
REPO: ${{ github.repository }}
PR_NO: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check out Git repository
uses: actions/checkout@v3
with:
ref: ${{ steps.get-branch.outputs.branch }}


- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Lint
run: |
forge fmt
pwd
if [[ `git diff --exit-code` ]]; then
git config --local user.name 'GitHub Actions Bot'
git config --local user.email '<>'
git add .
git commit -m "Github Actions automatically updated formatting with forge fmt"
COMMIT_HASH=$(git rev-parse HEAD)
echo "# Github Actions automatically updated formatting with forge fmt\n$COMMIT_HASH" >> .git-blame-ignore-revs
git add .git-blame-ignore-revs
git commit -m "Updated .git-blame-ignore-revs with commit $COMMIT_HASH"
BRANCH_NAME=$(git symbolic-ref --short HEAD)
git push origin $BRANCH_NAME
fi
id: update
37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Forge Linting

on:
push:
branches: [main]
tags: ["*"]
pull_request:
types: [opened, reopened, synchronize]

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Lint
run: |
echo "Running forge fmt --check"
if ! forge fmt --check; then
echo "The linting check failed. You can fix it locally with `forge fmt` and then push, or you can have a GitHub action take care of it for you by commenting '!fix' on the PR."
exit 1
fi
102 changes: 85 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,102 @@
name: test
name: Seaport Test CI

on: workflow_dispatch
on:
push:
branches: [main, 1.*, 2.*]
tags: ["*"]
pull_request:
types: [opened, reopened, synchronize]

env:
FOUNDRY_PROFILE: ci
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
forge:
name: Run Forge Tests (via_ir = true; fuzz_runs = 5000)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build
- name: Install forge dependencies
run: forge install

- name: Precompile reference using 0.8.13 and via-ir=false
run: FOUNDRY_PROFILE=reference forge build

- name: Precompile optimized using 0.8.17 and via-ir=true
run: FOUNDRY_PROFILE=optimized forge build

- name: Run tests
run: FOUNDRY_PROFILE=test forge test -vvv

- name: Run Forge tests
- name: Lint
run: |
forge test -vvv
id: test
forge fmt
pwd
if [[ `git diff --exit-code` ]]; then
git config --local user.name 'GitHub Actions Bot'
git config --local user.email '<>'
git add .
git commit -m "Github Actions automatically updated formatting with forge fmt"
COMMIT_HASH=$(git rev-parse HEAD)
echo "# Github Actions automatically updated formatting with forge fmt\n$COMMIT_HASH" >> .git-blame-ignore-revs
git add .git-blame-ignore-revs
git commit -m "Updated .git-blame-ignore-revs with commit $COMMIT_HASH"
BRANCH_NAME=$(git symbolic-ref --short HEAD)
git push origin $BRANCH_NAME
fi
id: update

forge-offerers:
name: Run Contract Offerer Forge Tests (via_ir = false; fuzz_runs = 1000)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install forge dependencies
run: forge install

- name: Run tests
run: FOUNDRY_PROFILE=offerers forge test -vvv

forge-coverage:
name: Run Forge Coverage report on tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install forge dependencies
run: forge install

- name: Run coverage with lcov output
run: SEAPORT_COVERAGE=true forge coverage --report lcov

- uses: codecov/codecov-action@v3
with:
files: ./lcov.info
flags: foundry

53 changes: 10 additions & 43 deletions src/core/lib/ConsiderationDecoder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1069,14 +1069,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function()
internal
pure
returns (
uint256,
OfferItem[] memory,
ConsiderationItem[] memory
)
function() internal pure returns ( uint256, OfferItem[] memory, ConsiderationItem[] memory)
outFn
)
{
Expand All @@ -1103,9 +1096,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function(OfferItem memory, address, bytes32, bytes memory)
internal
outFn
function(OfferItem memory, address, bytes32, bytes memory) internal outFn
)
{
assembly {
Expand All @@ -1131,8 +1122,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function(ConsiderationItem memory, address, bytes32, bytes memory)
internal
function(ConsiderationItem memory, address, bytes32, bytes memory) internal
outFn
)
{
Expand All @@ -1158,10 +1148,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function(CalldataPointer)
internal
pure
returns (OrderParameters memory)
function(CalldataPointer) internal pure returns (OrderParameters memory)
outFn
)
{
Expand All @@ -1187,10 +1174,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function(CalldataPointer)
internal
pure
returns (AdvancedOrder memory)
function(CalldataPointer) internal pure returns (AdvancedOrder memory)
outFn
)
{
Expand All @@ -1216,10 +1200,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function(CalldataPointer)
internal
pure
returns (CriteriaResolver[] memory)
function(CalldataPointer) internal pure returns (CriteriaResolver[] memory)
outFn
)
{
Expand All @@ -1245,11 +1226,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function(CalldataPointer)
internal
pure
returns (Order[] memory)
outFn
function(CalldataPointer) internal pure returns (Order[] memory) outFn
)
{
assembly {
Expand All @@ -1276,10 +1253,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function(CalldataPointer)
internal
pure
returns (FulfillmentComponent[][] memory)
function(CalldataPointer) internal pure returns (FulfillmentComponent[][] memory)
outFn
)
{
Expand All @@ -1305,10 +1279,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function(CalldataPointer)
internal
pure
returns (AdvancedOrder[] memory)
function(CalldataPointer) internal pure returns (AdvancedOrder[] memory)
outFn
)
{
Expand All @@ -1334,11 +1305,7 @@ contract ConsiderationDecoder {
internal
pure
returns (
function(CalldataPointer)
internal
pure
returns (Fulfillment[] memory)
outFn
function(CalldataPointer) internal pure returns (Fulfillment[] memory) outFn
)
{
assembly {
Expand Down
7 changes: 0 additions & 7 deletions src/main/conduit/ConduitController.sol

This file was deleted.

Loading

0 comments on commit 64f9ed9

Please sign in to comment.