diff --git a/.github/workflows/ship-test-api-image.yml b/.github/workflows/ship-test-api-image.yml index 81cbce9..0bae7d8 100644 --- a/.github/workflows/ship-test-api-image.yml +++ b/.github/workflows/ship-test-api-image.yml @@ -1,4 +1,4 @@ -name: Build SDK test runner +name: Build and Push to Artifact Registry on: workflow_dispatch: @@ -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: @@ -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 diff --git a/.github/workflows/test-sdk-packages.yml b/.github/workflows/test-sdk-packages.yml index 8ee7d93..22832d1 100644 --- a/.github/workflows/test-sdk-packages.yml +++ b/.github/workflows/test-sdk-packages.yml @@ -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}" @@ -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: | @@ -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 @@ -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 diff --git a/package-testing/php-sdk-relay/build-and-run.sh b/package-testing/php-sdk-relay/build-and-run.sh index 0b0c714..f944187 100755 --- a/package-testing/php-sdk-relay/build-and-run.sh +++ b/package-testing/php-sdk-relay/build-and-run.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# TODO Configure env + composer install # Set default values for vars diff --git a/package-testing/php-sdk-relay/container-run.sh b/package-testing/php-sdk-relay/docker-run.sh similarity index 91% rename from package-testing/php-sdk-relay/container-run.sh rename to package-testing/php-sdk-relay/docker-run.sh index 7dfcbc5..593a306 100755 --- a/package-testing/php-sdk-relay/container-run.sh +++ b/package-testing/php-sdk-relay/docker-run.sh @@ -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 \ diff --git a/package-testing/sdk-test-runner/test-sdk.sh b/package-testing/sdk-test-runner/test-sdk.sh index 3e9019b..68319d8 100755 --- a/package-testing/sdk-test-runner/test-sdk.sh +++ b/package-testing/sdk-test-runner/test-sdk.sh @@ -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