add lock for concurrently writing to map #2720
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "TON - CCIP Integration Tests" | |
on: | |
pull_request: | |
push: | |
branches: | |
- "main" | |
permissions: | |
contents: read | |
actions: read | |
env: | |
DOCKER_CACHE_KEY: ccip-e2e-images-v2 | |
DOCKER_CACHE_DIR: ${{ github.workspace }}/.cache | |
DOCKER_CACHE_TAR_NAME: ccip-e2e-docker-images.tar | |
# mylocalton docker image / CCIP E2E test database image | |
DOCKER_IMAGES: >- | |
ghcr.io/neodix42/mylocalton-docker:v3.7 | |
postgres:16-alpine | |
jobs: | |
prepare-images: | |
name: Prepare and Cache Docker Images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare cache dir | |
run: mkdir -p ${{ env.DOCKER_CACHE_DIR }} | |
- name: Restore image-tar cache | |
id: cache-images | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.DOCKER_CACHE_DIR }}/${{ env.DOCKER_CACHE_TAR_NAME }} | |
key: ${{ env.DOCKER_CACHE_KEY }} | |
- name: Pull & save images on cache miss | |
if: steps.cache-images.outputs.cache-hit != 'true' | |
run: | | |
echo "Cache miss: pulling images" | |
for img in ${{ env.DOCKER_IMAGES }}; do | |
docker pull "$img" | |
done | |
echo "Saving to tarball…" | |
docker save ${{ env.DOCKER_IMAGES }} \ | |
-o ${{ env.DOCKER_CACHE_DIR }}/${{ env.DOCKER_CACHE_TAR_NAME }} | |
integration-test-matrix: | |
needs: prepare-images | |
strategy: | |
fail-fast: false | |
matrix: | |
type: | |
# Note: list of tests, add more tests here | |
- name: "TON2EVM Messaging Test" | |
cmd: "cd integration-tests && go test ./smoke/ccip -run Test_CCIPMessaging_TON2EVM -timeout 20m -test.parallel=1 -count=1 -json" | |
- name: "EVM2TON Messaging Test" | |
cmd: "cd integration-tests && go test ./smoke/ccip -run Test_CCIPMessaging_EVM2TON -timeout 20m -test.parallel=1 -count=1 -json" | |
name: ${{ matrix.type.name }} | |
# ubuntu-latest: 4 / 16 GB / 150GB SSD https://github.com/smartcontractkit/chainlink-ton/actions/runners | |
runs-on: ubuntu-latest-4cores-16GB | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
- name: Restore cached docker images | |
id: docker-cache-restore | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.DOCKER_CACHE_DIR }}/${{ env.DOCKER_CACHE_TAR_NAME }} | |
key: ${{ env.DOCKER_CACHE_KEY }} | |
- name: Load docker images | |
if: steps.docker-cache-restore.outputs.cache-hit == 'true' | |
run: | | |
echo "Cache hit for key '${{ env.DOCKER_CACHE_KEY }}'. Loading images from tarball..." | |
docker load -i ${{ env.DOCKER_CACHE_DIR }}/${{ env.DOCKER_CACHE_TAR_NAME }} | |
- name: Install Nix | |
uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f # v31 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
# cache Go build artifacts and modules to speed up subsequent runs | |
# key includes go.sum files from both chainlink-ton and chainlink core repos | |
# paths are standard Go cache locations on GitHub Actions runners | |
- name: Cache Go modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
/home/runner/.cache/go-build | |
/home/runner/go/pkg/mod | |
key: go-${{ hashFiles('**/go.sum', 'chainlink/**/go.sum') }} | |
- name: Read Chainlink Core Ref from .core_version | |
id: read_core_ref | |
run: echo "CORE_REF=$(cat ./scripts/.core_version | tr -d '[:space:]')" >> $GITHUB_OUTPUT | |
# cache the entire Chainlink Core repository to avoid re-cloning | |
# key is based on the exact commit SHA from .core_version file | |
# only checkout if cache miss occurs | |
- name: Cache Chainlink Core repo | |
uses: actions/cache@v4 | |
id: core-cache | |
with: | |
path: chainlink | |
key: core-${{ steps.read_core_ref.outputs.CORE_REF }} | |
- name: Checkout Chainlink Core repo | |
if: steps.core-cache.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: smartcontractkit/chainlink | |
ref: ${{ steps.read_core_ref.outputs.CORE_REF }} | |
path: chainlink | |
- name: Build contracts | |
run: | | |
cd contracts | |
nix develop .#contracts -c yarn && yarn build | |
- name: Setup Environment and Run Tests | |
run: | | |
nix develop .#ccip-e2e -c scripts/e2e/setup-env.sh --core-dir "${GITHUB_WORKSPACE}/chainlink" | |
nix develop .#ccip-e2e -c scripts/e2e/run-test.sh --core-dir "${GITHUB_WORKSPACE}/chainlink" --test-command "${{ matrix.type.cmd }}" | |
- name: Upload e2e test logs on failure | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ccip-test-logs-${{ matrix.type.name }} | |
path: chainlink/integration-tests/smoke/ccip/logs/ | |
retention-days: 7 | |
integration-test-ccip: | |
if: always() | |
runs-on: ubuntu-latest | |
needs: [integration-test-matrix] | |
steps: | |
- name: Fail if any CCIP test failed | |
if: always() && needs.integration-test-matrix.result == 'failure' | |
run: exit 1 |