Skip to content

Commit

Permalink
action test
Browse files Browse the repository at this point in the history
  • Loading branch information
typotter committed Nov 13, 2024
1 parent a45147d commit f713eff
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 36 deletions.
67 changes: 56 additions & 11 deletions .github/workflows/ship-test-api-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build SDK test runner
name: Build and Push to Artifact Registry

on:
workflow_dispatch:
Expand All @@ -10,6 +10,11 @@ env:
VERSION: 1.0.0
TAR_NAME: sdk-test-runner-latest.tar

PROJECT_ID: fake-app-323017
REGION: northamerica-northeast1
GAR_LOCATION: northamerica-northeast1-docker.pkg.dev/fake-app-323017/repo-1/


jobs:

build-and-upload:
Expand All @@ -19,23 +24,63 @@ jobs:
working-directory: "package-testing/sdk-test-runner"

steps:
- uses: actions/checkout@v3
- name: "Checkout"
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Set up gCloud
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}"

- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"

- name: "Use gcloud CLI"
run: "gcloud info"

# Allow docker access to the GAR
- name: "Docker auth"
run: |-
gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
# Build and push
- name: Build and export
uses: docker/build-push-action@v6
with:
push: true
context: ./package-testing/sdk-test-runner
tags: Eppo-exp/sdk-test-runner:latest,Eppo-exp/sdk-test-runner:${{ env.VERSION }}
outputs: type=docker,dest=/tmp/sdk-test-runner.tar


# outputs: type=docker,dest=/tmp/sdk-test-runner.tar

# - name: Build image
# run: docker build . --file DOCKERFILE_LOCATION --tag ${{ env.GAR_LOCATION }}
# working-directory: WORKING_DIRECTORY

# - name: Push image
# run: docker push ${{ env.GAR_LOCATION }}




# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sdk-test-runner-image
path: /tmp/sdk-test-runner.tar
# - name: Build and export
# uses: docker/build-push-action@v6
# with:
# context: ./package-testing/sdk-test-runner
# tags: Eppo-exp/sdk-test-runner:latest,Eppo-exp/sdk-test-runner:${{ env.VERSION }}
# outputs: type=docker,dest=/tmp/sdk-test-runner.tar

# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: sdk-test-runner-image
# path: /tmp/sdk-test-runner.tar



Expand Down
34 changes: 12 additions & 22 deletions .github/workflows/test-sdk-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ jobs:
EPPO_API_HOST: ${{matrix.sdk.hostAddressFromDocker}}
SDK_RELAY_HOST: ${{matrix.sdk.hostAddressFromDocker}}
TEST_RUNNER_HOST: ${{matrix.sdk.hostAddressFromDocker}}
EPPO_SDK_PLATFORM: linux

steps:


- name: Test information header
- name: Test information heade
shell: bash
run: echo "Running Test Cluster for ${SDK_NAME}"

Expand All @@ -41,20 +42,17 @@ jobs:
run: |
echo "::set-output name=date::$(date +'%Y-%m-%d')"
echo "SAFE_SDK_NAME=$(echo ${SDK_NAME} | sed 's/\//_/g')" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Download Test Runner image
uses: actions/download-artifact@v4
- name: "Checkout"
uses: actions/checkout@v3

# Pull from GAR instead
- name: Build and export
uses: docker/build-push-action@v6
with:
name: sdk-test-runner-image
path: /tmp/sdk-test-runner.tar

- name: Load Test Runner image
run: |
docker load --input /tmp/sdk-test-runner.tar
docker image ls -a
context: ./package-testing/sdk-test-runner
tags: Eppo-exp/sdk-test-runner:latest,Eppo-exp/sdk-test-runner:local

- name: Prepare testing API server image
run: |
Expand All @@ -69,13 +67,14 @@ jobs:
./test-sdk.sh server ${SDK_NAME}
ls -al ./logs
popd
- name: Logs
if: success() || failure() # always run even if the previous steps fail
run: |
echo "List log files"
pushd package-testing/sdk-test-runner
ls logs
cat logs/sdk.log
popd
Expand All @@ -92,12 +91,3 @@ jobs:
if: success() || failure() # always run even if the previous steps fail
with:
report_paths: 'package-testing/sdk-test-runner/logs/results.xml'

# - name: Test Report
# if: success() || failure() # always run even if the previous steps fail
# run: |
# echo "Link to the rendered test report"
# pushd package-testing/sdk-test-runner
# ls logs
# cat logs/test_runner.log
# popd
2 changes: 2 additions & 0 deletions package-testing/php-sdk-relay/build-and-run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

# TODO Configure env

composer install

# Set default values for vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ docker build . -t Eppo-exp/php-sdk-relay:$VERSION
docker run -p $SDK_RELAY_PORT:$SDK_RELAY_PORT \
--add-host host.docker.internal:host-gateway \
-e SDK_REF \
-e EPPO_API_HOST=host.docker.internal \
-e EPPO_BASE_URL \
-e SDK_RELAY_PORT \
--name php-relay \
-d --rm \
Expand Down
2 changes: 0 additions & 2 deletions package-testing/sdk-test-runner/test-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ case "$command" in
exit_with_message "SDK Relay does not have a launch script in $SDK_DIR"
fi


./build-and-run.sh >> ${RUNNER_DIR}/logs/sdk.log 2>&1 &
SDK_RELAY_PID=$!
popd

Expand Down

0 comments on commit f713eff

Please sign in to comment.