From 24e1fe5ebf59ca8f2aa6cf00a7ce802fbce17c65 Mon Sep 17 00:00:00 2001 From: guillaumemichel Date: Thu, 14 Nov 2024 13:30:55 +0100 Subject: [PATCH] test interop cache --- .github/workflows/interop-test.yml | 103 +++++++++++++++-------------- scripts/build-interop-image.sh | 14 ++-- 2 files changed, 60 insertions(+), 57 deletions(-) diff --git a/.github/workflows/interop-test.yml b/.github/workflows/interop-test.yml index e9446d013d7..52586fc0bc6 100644 --- a/.github/workflows/interop-test.yml +++ b/.github/workflows/interop-test.yml @@ -1,59 +1,62 @@ name: Interoperability Testing on: - pull_request: - push: - branches: - - "master" + pull_request: + push: + branches: + - "master" concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - run-transport-interop: - name: Run transport interoperability tests - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository - runs-on: ${{ fromJSON(github.repository == 'libp2p/rust-libp2p' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }} - strategy: - matrix: - flavour: [chromium, native] - steps: - - uses: actions/checkout@v4 + run-transport-interop: + name: Run transport interoperability tests + # if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository + runs-on: ${{ fromJSON(github.repository == 'libp2p/rust-libp2p' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }} + strategy: + matrix: + flavour: [chromium, native] + steps: + - uses: actions/checkout@v4 - - uses: docker/setup-buildx-action@v3 + - uses: docker/setup-buildx-action@v3 - - name: Build ${{ matrix.flavour }} image - run: ./scripts/build-interop-image.sh - env: - AWS_BUCKET_NAME: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }} - AWS_ACCESS_KEY_ID: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }} - FLAVOUR: ${{ matrix.flavour }} + - name: Build ${{ matrix.flavour }} image + run: ./scripts/build-interop-image.sh + env: + AWS_BUCKET_NAME: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }} + AWS_ACCESS_KEY_ID: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_REGION }} + FLAVOUR: ${{ matrix.flavour }} - - name: Run ${{ matrix.flavour }} tests - uses: libp2p/test-plans/.github/actions/run-transport-interop-test@master - with: - test-filter: ${{ matrix.flavour }}-rust-libp2p-head - extra-versions: ${{ github.workspace }}/interop-tests/${{ matrix.flavour }}-ping-version.json - s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }} - s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }} - s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }} - worker-count: 16 - run-holepunching-interop: - name: Run hole-punch interoperability tests - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository - runs-on: ${{ fromJSON(github.repository == 'libp2p/rust-libp2p' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }} - steps: - - uses: actions/checkout@v4 - - uses: docker/setup-buildx-action@v3 - - name: Build image - run: docker buildx build --load -t rust-libp2p-head . -f hole-punching-tests/Dockerfile - - name: Run tests - uses: libp2p/test-plans/.github/actions/run-interop-hole-punch-test@master - with: - test-filter: rust-libp2p-head - extra-versions: ${{ github.workspace }}/hole-punching-tests/version.json - s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }} - s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }} - s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }} - worker-count: 16 + - name: Run ${{ matrix.flavour }} tests + uses: libp2p/test-plans/.github/actions/run-transport-interop-test@master + with: + test-filter: ${{ matrix.flavour }}-rust-libp2p-head + extra-versions: ${{ github.workspace }}/interop-tests/${{ matrix.flavour }}-ping-version.json + s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }} + s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }} + s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_REGION }} + worker-count: 16 + run-holepunching-interop: + name: Run hole-punch interoperability tests + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository + runs-on: ${{ fromJSON(github.repository == 'libp2p/rust-libp2p' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }} + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - name: Build image + run: docker buildx build --load -t rust-libp2p-head . -f hole-punching-tests/Dockerfile + - name: Run tests + uses: libp2p/test-plans/.github/actions/run-interop-hole-punch-test@master + with: + test-filter: rust-libp2p-head + extra-versions: ${{ github.workspace }}/hole-punching-tests/version.json + s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }} + s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }} + s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_REGION }} + worker-count: 16 diff --git a/scripts/build-interop-image.sh b/scripts/build-interop-image.sh index 4b96e353f9a..a0a94daa5d2 100755 --- a/scripts/build-interop-image.sh +++ b/scripts/build-interop-image.sh @@ -6,13 +6,13 @@ CACHE_TO="" # If we have credentials, write to cache if [[ -n "${AWS_SECRET_ACCESS_KEY}" ]]; then - CACHE_TO="--cache-to type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=ap-southeast-2,prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head" + CACHE_TO="--cache-to type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=${AWS_REGION},prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head" fi docker buildx build \ - --load \ - $CACHE_TO \ - --cache-from type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=ap-southeast-2,prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head \ - -t ${FLAVOUR}-rust-libp2p-head \ - . \ - -f interop-tests/Dockerfile.${FLAVOUR} + --load \ + $CACHE_TO \ + --cache-from type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=${AWS_REGION},prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head \ + -t ${FLAVOUR}-rust-libp2p-head \ + . \ + -f interop-tests/Dockerfile.${FLAVOUR}