Skip to content

Conversation

@jadepark-dev
Copy link
Collaborator

@jadepark-dev jadepark-dev commented May 13, 2025

This PR introduces CTF integration in TON blockchain integration tests with GHA Cache NONEVM-1712

Primary Changes

  • Added GitHub Action for caching MyLocalTon Docker images to optimize CI test runs
  • Created a example integration test for TON blockchain smoke testing
  • Implemented Docker image caching mechanism to improve test execution time

Others

  • Added cache directory structure and configuration for storing Docker images
  • Configured scheduled weekly cache updates to ensure fresh images
  • Set up TON blockchain configuration for test environment

Requires

@jadepark-dev jadepark-dev changed the title [DRAFT] CTF with GHA Cache [NONEVM-1712] CTF Integration with GHA Cache May 14, 2025
@jadepark-dev jadepark-dev marked this pull request as ready for review May 14, 2025 08:41
Copilot AI review requested due to automatic review settings May 14, 2025 08:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces CTF integration for TON blockchain integration tests by adding a caching mechanism for MyLocalTon Docker images, which aims to speed up CI test runs.

  • Added a TOML configuration for TON blockchain integration
  • Created a new Go-based integration test for TON blockchain smoke testing
  • Configured GitHub workflows and a composite action to pull, cache, and refresh Docker images

Reviewed Changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
integration-tests/examples/smoke_ton.toml New config file defining blockchain type, image URL, and service list for TON tests.
integration-tests/examples/ctf_test.go Introduces an integration test including blockchain network setup and wallet operations.
.github/workflows/test-ctf.yml Workflow to run integration tests along with setting up MyLocalTon images and Go environment.
.github/workflows/cache-mylocalton-images.yml Workflow for scheduled and manual caching of MyLocalTon Docker images.
.github/actions/mylocalton-images/action.yml Composite action to prepare cache directories, manage Docker image pulls/saves, and update the cache.
Files not reviewed (2)
  • integration-tests/.gitignore: Language not supported
  • integration-tests/go.mod: Language not supported

runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Copy link

Copilot AI May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a stable version tag (e.g., actions/checkout@v4) instead of a commit hash to make the workflow easier to maintain.

Suggested change
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
uses: actions/checkout@v4

Copilot uses AI. Check for mistakes.
uses: actions/cache@v4
with:
path: ${{ inputs.cache-dir }}/docker-images.tar
key: mylocalton-images-${{ hashFiles('${{ inputs.cache-dir }}/docker-compose.yml') }}
Copy link

Copilot AI May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Double-check the use of nested expressions inside hashFiles; consider simplifying the expression to ensure that the correct file is hashed for cache key generation.

Suggested change
key: mylocalton-images-${{ hashFiles('${{ inputs.cache-dir }}/docker-compose.yml') }}
key: mylocalton-images-${{ hashFiles(compose_file_path) }}

Copilot uses AI. Check for mistakes.
uses: ./.github/actions/mylocalton-images

- name: Setup Go
uses: smartcontractkit/.github/actions/setup-golang@setup-golang/v1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adopt and use Nix - we will not use custom unportable GHA setups

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, absolutely. I had copied it from another repo’s workflow and added it temporarily because the Go dependency installation was taking a long time during testing. Thanks for the feedback!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 7b3cde2

description: 'Space-separated list of Docker images'
required: false
default: >-
ghcr.io/neodix42/mylocalton-docker:latest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to simplify this custom action (ideally remove it completely) by reusing existing Docker bake action which has support for caching and pulling from cache using an additional configuration file: https://twistezo.github.io/blog/posts/caching-docker

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question about this part — please correct me if I’m wrong. I ran some tests based on the reference link you shared, but the docker-compose file we’ll be using (which will be hosted remotely and not modified) doesn’t include any build step. My understanding is that Docker Bake Action is primarily for caching build layers. Because of that, I initially failed to implement it, but I’ll give it another try. I agree that we should avoid using custom scripts.

Comment on lines 3 to 4
image = "https://raw.githubusercontent.com/neodix42/mylocalton-docker/main/docker-compose.yaml"
ton_core_services = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this declared as an image?

Why are these services configured as ton_core_services - couldn't this be general Docker compose support, and a configuration for a list of any Docker compose services?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I initially used the existing field image, but it has now been changed to docker_compose_file_url.

You’re right about the Docker images — it makes sense for the field names to represent general image options that can be selected within a Docker Compose setup

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced with docker_compose_file_url / docker_compose_services. fixed in f9b8858

Comment on lines 1 to 2
[blockchain_a]
type = "ton"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blockchain_a]
type = "ton"

What is blockchain_a?
What is type = "ton" used for, if we also configure the docker-compose.yaml file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are CTF configuration fields.

iiuc, blockchain_a indicates the first blockchain involved in this test setup

Here's the other test configuration involving 2 chains -- with blockchain_a and blockchain_b
https://github.com/smartcontractkit/chainlink-testing-framework/blob/96212dfb45f083f6358e7a85f4e0e85d35353168/framework/examples/myproject/chaos/chaos_reorg.toml#L7

type = "ton" is another input field used for getting the right blockchain handler
https://github.com/smartcontractkit/chainlink-testing-framework/blob/96212dfb45f083f6358e7a85f4e0e85d35353168/framework/components/blockchain/blockchain.go#L82

I’m checking how we can move this chain-specific test network implementation into chainlink-ton, then probably other integration projects would import it when they need to run tests related to TON, since these fields will likely be needed for them as well?

@jadepark-dev
Copy link
Collaborator Author

Closing this PR to switch to a different E2E pattern. #18 The image caching and test setup can still be reused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants