From b18a057a58f6c67f655337be13f0ffc17d030884 Mon Sep 17 00:00:00 2001 From: chad Date: Mon, 27 Jan 2025 16:34:55 -0500 Subject: [PATCH] ci: add e2e test job --- .github/workflows/e2e.yml | 35 +++++++++++++++++++++++++++++++++++ scripts/build-e2e-image.sh | 18 ++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/e2e.yml create mode 100644 scripts/build-e2e-image.sh diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 00000000..ff31bf43 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,35 @@ +name: End-to-end testing +on: + pull_request: + push: + branches: + - "master" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + run-atoma-e2e-tests: + name: Run Atoma e2e tests + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository + runs-on: ${{ fromJSON(github.repository == 'atoma-network/atoma-node' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }} + strategy: + matrix: + flavour: [chromium, native] + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - name: Build ${{ matrix.flavour }} image + run: ./scripts/build-e2e-image.sh + env: + AWS_BUCKET_NAME: ${{ vars.S3_ATOMA_BUILD_CACHE_BUCKET_NAME }} + AWS_ACCESS_KEY_ID: ${{ vars.S3_ATOMA_BUILD_CACHE_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ATOMA_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ vars.S3_ATOMA_BUILD_CACHE_AWS_REGION }} + FLAVOUR: ${{ matrix.flavour }} + + - name: Run ${{ matrix.flavour }} tests + uses: atoma-network/atoma-testground/.github/actions/run-chat-completion-request@master diff --git a/scripts/build-e2e-image.sh b/scripts/build-e2e-image.sh new file mode 100644 index 00000000..d6bd5460 --- /dev/null +++ b/scripts/build-e2e-image.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# This uses the same S3 cache as all test-plans images. Because we use `cargo-chef` in the Dockerfile, we have a layer available with all dependencies built. + +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=${AWS_REGION},prefix=buildCache,name=${FLAVOUR}-atoma-node-head" +fi + +docker buildx build \ + --load \ + $CACHE_TO \ + --cache-from type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=${AWS_REGION},prefix=buildCache,name=${FLAVOUR}-atoma-node-head \ + -t ${FLAVOUR}-atoma-node-head \ + . \ + -f e2e-tests/Dockerfile.${FLAVOUR} \ No newline at end of file