|
| 1 | +name: fork-pr-integration-tests-aws |
| 2 | + |
| 3 | +on: [pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build-docker-image: |
| 7 | + if: github.repository == 'your github repo' # swap here with your project id |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v3 |
| 11 | + with: |
| 12 | + # pull_request_target runs the workflow in the context of the base repo |
| 13 | + # as such actions/checkout needs to be explicit configured to retrieve |
| 14 | + # code from the PR. |
| 15 | + ref: refs/pull/${{ github.event.pull_request.number }}/merge |
| 16 | + submodules: recursive |
| 17 | + - name: Set up QEMU |
| 18 | + uses: docker/setup-qemu-action@v1 |
| 19 | + - name: Set up Docker Buildx |
| 20 | + uses: docker/setup-buildx-action@v2 |
| 21 | + with: |
| 22 | + install: true |
| 23 | + - name: Set up AWS SDK |
| 24 | + uses: aws-actions/configure-aws-credentials@v1 |
| 25 | + with: |
| 26 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 27 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 28 | + aws-region: us-west-2 |
| 29 | + - name: Login to Amazon ECR |
| 30 | + id: login-ecr |
| 31 | + uses: aws-actions/amazon-ecr-login@v1 |
| 32 | + - name: Set ECR image tag |
| 33 | + id: image-tag |
| 34 | + run: echo "::set-output name=DOCKER_IMAGE_TAG::`git rev-parse HEAD`" |
| 35 | + - name: Cache Public ECR Image |
| 36 | + id: lambda_python_3_9 |
| 37 | + uses: actions/cache@v2 |
| 38 | + with: |
| 39 | + path: ~/cache |
| 40 | + key: lambda_python_3_9 |
| 41 | + - name: Handle Cache Miss (pull public ECR image & save it to tar file) |
| 42 | + if: steps.cache-primes.outputs.cache-hit != 'true' |
| 43 | + run: | |
| 44 | + mkdir -p ~/cache |
| 45 | + docker pull public.ecr.aws/lambda/python:3.9 |
| 46 | + docker save public.ecr.aws/lambda/python:3.9 -o ~/cache/lambda_python_3_9.tar |
| 47 | + - name: Handle Cache Hit (load docker image from tar file) |
| 48 | + if: steps.cache-primes.outputs.cache-hit == 'true' |
| 49 | + run: | |
| 50 | + docker load -i ~/cache/lambda_python_3_9.tar |
| 51 | + - name: Build and push |
| 52 | + env: |
| 53 | + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} |
| 54 | + ECR_REPOSITORY: feast-python-server |
| 55 | + run: | |
| 56 | + docker build \ |
| 57 | + --file sdk/python/feast/infra/feature_servers/aws_lambda/Dockerfile \ |
| 58 | + --tag $ECR_REGISTRY/$ECR_REPOSITORY:${{ steps.image-tag.outputs.DOCKER_IMAGE_TAG }} \ |
| 59 | + --load \ |
| 60 | + . |
| 61 | + docker push $ECR_REGISTRY/$ECR_REPOSITORY:${{ steps.image-tag.outputs.DOCKER_IMAGE_TAG }} |
| 62 | + outputs: |
| 63 | + DOCKER_IMAGE_TAG: ${{ steps.image-tag.outputs.DOCKER_IMAGE_TAG }} |
| 64 | + integration-test-python: |
| 65 | + if: github.repository == 'your github repo' # swap here with your project id |
| 66 | + runs-on: ${{ matrix.os }} |
| 67 | + strategy: |
| 68 | + fail-fast: false |
| 69 | + matrix: |
| 70 | + python-version: [ "3.8" ] |
| 71 | + os: [ ubuntu-latest ] |
| 72 | + env: |
| 73 | + OS: ${{ matrix.os }} |
| 74 | + PYTHON: ${{ matrix.python-version }} |
| 75 | + services: |
| 76 | + redis: |
| 77 | + image: redis |
| 78 | + ports: |
| 79 | + - 6379:6379 |
| 80 | + options: >- |
| 81 | + --health-cmd "redis-cli ping" |
| 82 | + --health-interval 10s |
| 83 | + --health-timeout 5s |
| 84 | + --health-retries 5 |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v2 |
| 87 | + with: |
| 88 | + # pull_request_target runs the workflow in the context of the base repo |
| 89 | + # as such actions/checkout needs to be explicit configured to retrieve |
| 90 | + # code from the PR. |
| 91 | + ref: refs/pull/${{ github.event.pull_request.number }}/merge |
| 92 | + submodules: recursive |
| 93 | + - name: Setup Python |
| 94 | + uses: actions/setup-python@v2 |
| 95 | + id: setup-python |
| 96 | + with: |
| 97 | + python-version: ${{ matrix.python-version }} |
| 98 | + architecture: x64 |
| 99 | + - name: Setup Go |
| 100 | + id: setup-go |
| 101 | + uses: actions/setup-go@v2 |
| 102 | + with: |
| 103 | + go-version: 1.18.0 |
| 104 | + - name: Set up AWS SDK |
| 105 | + uses: aws-actions/configure-aws-credentials@v1 |
| 106 | + with: |
| 107 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 108 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 109 | + aws-region: us-west-2 |
| 110 | + - name: Use AWS CLI |
| 111 | + run: aws sts get-caller-identity |
| 112 | + - name: Upgrade pip version |
| 113 | + run: | |
| 114 | + pip install --upgrade "pip>=21.3.1,<22.1" |
| 115 | + - name: Get pip cache dir |
| 116 | + id: pip-cache |
| 117 | + run: | |
| 118 | + echo "::set-output name=dir::$(pip cache dir)" |
| 119 | + - name: pip cache |
| 120 | + uses: actions/cache@v2 |
| 121 | + with: |
| 122 | + path: | |
| 123 | + ${{ steps.pip-cache.outputs.dir }} |
| 124 | + /opt/hostedtoolcache/Python |
| 125 | + /Users/runner/hostedtoolcache/Python |
| 126 | + key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-pip-${{ hashFiles(format('**/py{0}-ci-requirements.txt', env.PYTHON)) }} |
| 127 | + restore-keys: | |
| 128 | + ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-pip- |
| 129 | + - name: Install pip-tools |
| 130 | + run: pip install pip-tools |
| 131 | + - name: Install apache-arrow on ubuntu |
| 132 | + if: matrix.os == 'ubuntu-latest' |
| 133 | + run: | |
| 134 | + sudo apt update |
| 135 | + sudo apt install -y -V ca-certificates lsb-release wget |
| 136 | + wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb |
| 137 | + sudo apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb |
| 138 | + sudo apt update |
| 139 | + sudo apt install -y -V libarrow-dev |
| 140 | + - name: Install apache-arrow on macos |
| 141 | + if: matrix.os == 'macOS-latest' |
| 142 | + run: brew install apache-arrow |
| 143 | + - name: Install dependencies |
| 144 | + run: make install-python-ci-dependencies |
| 145 | + - name: Setup Redis Cluster |
| 146 | + run: | |
| 147 | + docker pull vishnunair/docker-redis-cluster:latest |
| 148 | + docker run -d -p 6001:6379 -p 6002:6380 -p 6003:6381 -p 6004:6382 -p 6005:6383 -p 6006:6384 --name redis-cluster vishnunair/docker-redis-cluster |
| 149 | + - name: Test python |
| 150 | + if: ${{ always() }} # this will guarantee that step won't be canceled and resources won't leak |
| 151 | + env: |
| 152 | + FEAST_SERVER_DOCKER_IMAGE_TAG: ${{ needs.build-docker-image.outputs.DOCKER_IMAGE_TAG }} |
| 153 | + run: | |
| 154 | + pytest -n 8 --cov=./ --cov-report=xml --color=yes sdk/python/tests --integration --durations=5 --timeout=1200 --timeout_method=thread -k "aws and not Snowflake and not BigQuery" |
| 155 | + pytest -n 8 --cov=./ --cov-report=xml --color=yes sdk/python/tests --integration --durations=5 --timeout=1200 --timeout_method=thread -k "File and not Snowflake and not BigQuery" |
| 156 | + pytest -n 8 --cov=./ --cov-report=xml --color=yes sdk/python/tests --integration --durations=5 --timeout=1200 --timeout_method=thread -k "dynamo and not Snowflake and not BigQuery" |
| 157 | + pytest -n 8 --cov=./ --cov-report=xml --color=yes sdk/python/tests --integration --durations=5 --timeout=1200 --timeout_method=thread -k "Redshift and not Snowflake and not BigQuery" |
| 158 | +
|
| 159 | +
|
0 commit comments