diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..cdb93b3 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,78 @@ +name: e2e +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + paths: + - '**.rs' + - '**.go' + - '**.toml' + - '**.lock' + - '**.mod' + - '**.sum' + - '**.sol' + - '.github/workflows/e2e.yml' +env: + FOUNDRY_PROFILE: ci + FOUNDRY_VERSION: nightly + +permissions: + contents: read + +jobs: + golangci: + name: test lint + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions/setup-go@v4 + with: + go-version: "1.22" + cache-dependency-path: tests/e2e/go.sum + + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.61 + working-directory: tests/e2e + e2e: + strategy: + fail-fast: false + matrix: + test: + - TestWithSolverTestSuite/TestDeploy + name: ${{ matrix.test }} + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: ${{ env.FOUNDRY_VERSION }} + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: "1.22" + check-latest: true + + - name: Install dependencies + run: | + forge install + go mod download + sudo apt-get update + sudo apt-get install -y build-essential + + - name: Run E2E Tests + run: | + make tidy + make e2e-test diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4577f23..bb3ff2d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,10 +11,10 @@ jobs: uses: actions/setup-go@v3 with: go-version: "1.21" - - name: Make tests + - name: Run unit tests run: | make tidy - make test + make unit-test lint: runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index ec681c4..24105dc 100644 --- a/Makefile +++ b/Makefile @@ -29,11 +29,18 @@ run-solver: ############################################################################### ### Testing ### ############################################################################### -test: - go clean -testcache - go test --tags=test -v -race $(shell go list ./... | grep -v /scripts/) - - +.PHONY: unit-test +unit-test: + go test --tags=test -v -race $(shell go list ./... | grep -v /tests) + +.PHONY: setup-foundry +setup-foundry: + cd tests/e2e && forge install foundry-rs/forge-std OpenZeppelin/openzeppelin-contracts OpenZeppelin/openzeppelin-contracts-upgradeable --no-commit + +.PHONY: e2e-test +e2e-test: setup-foundry + + cd tests/e2e && go test -v ./ ############################################################################### ### Developer Tools ### ############################################################################### diff --git a/README.md b/README.md index 9f15bca..2c344a1 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,8 @@ make run-solver --config --keys --key-store-type ### How to run tests ```shell -make test # run all tests +make unit-test +make e2e-test ``` ### Database access