From c4f5dc71ee6f6bb0de915db32a402100d9ec012e Mon Sep 17 00:00:00 2001 From: Makram Date: Mon, 19 Aug 2024 18:15:02 +0300 Subject: [PATCH 1/4] add README.md (#61) * add README.md * add some more info to readme * Update README.md --------- Co-authored-by: Will Winder --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..e202ea482 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# chainlink-ccip + +This is the repo that implements the OCR3 CCIP plugins. This includes the commit and execution plugins. + +## Getting Started + +### Go Version + +This repo uses Go 1.22. You can install Go from their [installation page](https://go.dev/doc/install). + +### Running the Linter + +We use golangci-lint as our linting tool. Run the linter like this: + +```sh +make lint +``` + +### Running the Unit Tests + +```sh +make test +``` + +### Generating the Mocks + +We use mockery to generate mocks and they're organized in the [mockery.yaml](./.mockery.yaml) file. + +```sh +make generate +``` + +## Development Cycle + +In order to keep the `ccip-develop` branch in working condition, we need to make sure the integration test +[written in the CCIP repo](https://github.com/smartcontractkit/ccip/blob/03ae3bbed0e6020be5fa9be26d03af21f152d7dc/core/capabilities/ccip/ccip_integration_tests/ocr3_node_test.go#L37) +will pass. + +As such, part of CI will run this integration test combined with your latest pushed change. + +Follow the steps below to ensure that we don't run into any unexpected breakages. + +1. Create a PR on chainlink-ccip with the changes you want to make. +2. CI will run the integration test in the CCIP repo after applying your changes. +3. If the integration test fails, make sure to fix it first before merging your changes into +the `ccip-develop` branch of chainlink-ccip. You can do this by: + - Creating a branch in the CCIP repo and running `go get github.com/smartcontractkit/chainlink-ccip@`. + - Fixing the build/tests. +4. Once your ccip PR is approved, merge it. +5. Go back to your chainlink-ccip PR and re-run the integration test workflow. +6. Once the integration test passes, merge your chainlink-ccip PR into `ccip-develop`, however do not delete the branch on the remote. +7. Create a new PR in ccip that points to the newly merged commit in the `ccip-develop` tree and merge that. From 8747a57d1ebbc76c894fbf0df324583e66b2c6d4 Mon Sep 17 00:00:00 2001 From: Makram Date: Mon, 19 Aug 2024 19:59:09 +0300 Subject: [PATCH 2/4] bump go to 1.22.5 (#62) * bump go to 1.22.5 * bump to 1.22 in CI * Update .github/workflows/ccip-ocr3-build-lint-test.yml --------- Co-authored-by: Will Winder --- .github/workflows/ccip-ocr3-build-lint-test.yml | 2 +- .github/workflows/codegen.yml | 2 +- Makefile | 3 +-- go.mod | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ccip-ocr3-build-lint-test.yml b/.github/workflows/ccip-ocr3-build-lint-test.yml index 47ad84128..751b597c6 100644 --- a/.github/workflows/ccip-ocr3-build-lint-test.yml +++ b/.github/workflows/ccip-ocr3-build-lint-test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go-version: ['1.21'] + go-version: ['1.21', '1.22'] defaults: run: working-directory: . diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 9a19fd602..bde74329f 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go-version: ['1.21'] + go-version: ['1.22'] defaults: run: working-directory: . diff --git a/Makefile b/Makefile index abb0ac382..1ccec7d6f 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,7 @@ lint: ensure_go_version golangci-lint run -c .golangci.yml ensure_go_version: - @go version | grep -q 'go1.21' || (echo "Please use go1.21" && exit 1) + @go version | grep -q 'go1.22' || (echo "Please use go1.22" && exit 1) ensure_golangcilint_1_59: @golangci-lint --version | grep -q '1.59' || (echo "Please use golangci-lint 1.59" && exit 1) - diff --git a/go.mod b/go.mod index e3894f4ce..ecf4e9170 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink-ccip -go 1.21.7 +go 1.22.5 require ( github.com/deckarep/golang-set/v2 v2.6.0 From 54260341b5800b44a1bbbd59e82ac9642631ecb2 Mon Sep 17 00:00:00 2001 From: Makram Date: Mon, 19 Aug 2024 20:25:40 +0300 Subject: [PATCH 3/4] .github/workflows: fix integration test workflow (#66) * try something else * use actions/checkout to checkout ccip repo * reference correct action * fix checkout --------- Co-authored-by: Will Winder --- .github/workflows/ccip-integration-test.yml | 32 ++++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ccip-integration-test.yml b/.github/workflows/ccip-integration-test.yml index 15dc0e3e3..8d4f8ac04 100644 --- a/.github/workflows/ccip-integration-test.yml +++ b/.github/workflows/ccip-integration-test.yml @@ -18,7 +18,7 @@ jobs: matrix: go-version: ['1.22.5'] steps: - - name: Checkout the repo + - name: Checkout the chainlink-ccip repo uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 - name: Setup Go ${{ matrix.go-version }} uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 @@ -27,35 +27,45 @@ jobs: - name: Display Go version run: go version - name: Clone CCIP repo + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + with: + repository: smartcontractkit/ccip + ref: ccip-develop + path: ccip + - name: Get the correct commit SHA via GitHub API + id: get_sha run: | - git clone https://github.com/smartcontractkit/ccip.git - cd ccip - git fetch - git checkout ccip-develop + if [ "${{ github.event_name }}" == "pull_request" ]; then + COMMIT_SHA=${{ github.event.pull_request.head.sha }} + else + COMMIT_SHA=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/commits/${{ github.ref }}" | jq -r .sha) + fi + echo "::set-output name=sha::$COMMIT_SHA" - name: Update chainlink-ccip dependency in ccip run: | - cd ccip - go get github.com/smartcontractkit/chainlink-ccip@${{ github.event.pull_request.head.sha }} + cd $GITHUB_WORKSPACE/ccip + go get github.com/smartcontractkit/chainlink-ccip@${{ steps.get_sha.outputs.sha }} make gomodtidy - name: Setup Postgres uses: ./.github/actions/setup-postgres - name: Download Go vendor packages run: | - cd ccip + cd $GITHUB_WORKSPACE/ccip go mod download - name: Build binary run: | - cd ccip + cd $GITHUB_WORKSPACE/ccip go build -o ccip.test . - name: Setup DB run: | - cd ccip + cd $GITHUB_WORKSPACE/ccip ./ccip.test local db preparetest env: CL_DATABASE_URL: ${{ env.DB_URL }} - name: Run ccip ocr3 integration test run: | - cd ccip + cd $GITHUB_WORKSPACE/ccip go test -v -timeout 3m -run "^TestIntegration_OCR3Nodes$" ./core/capabilities/ccip/ccip_integration_tests EXITCODE=${PIPESTATUS[0]} if [ $EXITCODE -ne 0 ]; then From f342f6b64fe5c26c483a523abf115816d09d97fa Mon Sep 17 00:00:00 2001 From: Makram Date: Tue, 20 Aug 2024 17:03:24 +0300 Subject: [PATCH 4/4] remove 1.21 from matrix (#72) --- .github/workflows/ccip-ocr3-build-lint-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccip-ocr3-build-lint-test.yml b/.github/workflows/ccip-ocr3-build-lint-test.yml index 751b597c6..e04d02ada 100644 --- a/.github/workflows/ccip-ocr3-build-lint-test.yml +++ b/.github/workflows/ccip-ocr3-build-lint-test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go-version: ['1.21', '1.22'] + go-version: ['1.22'] defaults: run: working-directory: .