|
| 1 | +name: Test Packaged Server SDKs |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + platform: |
| 7 | + description: 'Platforms to test the SDK Relay on; linux, macos, windows' |
| 8 | + type: string |
| 9 | + required: true |
| 10 | + sdkName: |
| 11 | + description: 'Name of the SDK' |
| 12 | + type: string |
| 13 | + required: true |
| 14 | + sdkRelayDir: |
| 15 | + description: 'Directory of the SDK Relay server code' |
| 16 | + type: string |
| 17 | + required: false |
| 18 | + os: |
| 19 | + description: 'Specific runner OS to use' |
| 20 | + type: string |
| 21 | + |
| 22 | + |
| 23 | +jobs: |
| 24 | + test-packaged-server-sdks: |
| 25 | + runs-on: ${{ inputs.os || inputs.platform == 'linux' && 'ubuntu-latest' || inputs.platform == 'macos' && 'macos-13' || inputs.platform == 'windows' && 'windows-latest' || 'NONE' }} |
| 26 | + |
| 27 | + env: |
| 28 | + SDK_NAME: ${{ inputs.sdkName }} |
| 29 | + SDK_DIR: ${{ inputs.sdkRelayDir }} |
| 30 | + EPPO_API_HOST: localhost |
| 31 | + SDK_RELAY_HOST: localhost |
| 32 | + TEST_RUNNER_HOST: localhost |
| 33 | + EPPO_SDK_PLATFORM: ${{ inputs.platform }} |
| 34 | + |
| 35 | + PROJECT_ID: ${{ vars.SDK_TESTING_PROJECT_ID }} |
| 36 | + REGION: ${{ vars.SDK_TESTING_REGION }} |
| 37 | + GAR_LOCATION: ${{ vars.SDK_TESTING_REGION }}-docker.pkg.dev/${{ vars.SDK_TESTING_PROJECT_ID }}/sdk-testing |
| 38 | + |
| 39 | + steps: |
| 40 | + - name: Test information header |
| 41 | + shell: bash |
| 42 | + run: echo "Running Test Cluster for ${SDK_NAME}" |
| 43 | + |
| 44 | + - name: Set some variables |
| 45 | + id: vars |
| 46 | + run: | |
| 47 | + echo "::set-output name=date::$(date +'%Y-%m-%d')" |
| 48 | + echo "SAFE_SDK_NAME=$(echo ${SDK_NAME} | sed 's/\//_/g')" >> $GITHUB_ENV |
| 49 | +
|
| 50 | +
|
| 51 | + - name: "Checkout" |
| 52 | + uses: actions/checkout@v3 |
| 53 | + |
| 54 | + # Set up docker (macos runners) |
| 55 | + - id: setup-docker |
| 56 | + if: ${{ inputs.platform == 'macos' }} |
| 57 | + name: Setup Docker |
| 58 | + uses: douglascamata/setup-docker-macos-action@v1-alpha |
| 59 | + |
| 60 | + # Set up gCloud |
| 61 | + - id: "auth" |
| 62 | + uses: "google-github-actions/auth@v1" |
| 63 | + with: |
| 64 | + credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}" |
| 65 | + |
| 66 | + - name: "Set up Cloud SDK" |
| 67 | + uses: "google-github-actions/setup-gcloud@v1" |
| 68 | + |
| 69 | + # Allow docker access to the GAR |
| 70 | + - name: "Docker auth" |
| 71 | + run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet |
| 72 | + |
| 73 | + # Pull test runner and testing api images for GCP Artifact Registry (GAR) and |
| 74 | + # retag them locally as expected by the runner script. |
| 75 | + - name: Pull Test Runner image |
| 76 | + run: | |
| 77 | + docker pull ${{ env.GAR_LOCATION }}/sdk-test-runner:latest |
| 78 | + docker tag ${{ env.GAR_LOCATION }}/sdk-test-runner:latest Eppo-exp/sdk-test-runner:latest |
| 79 | + docker pull ${{ env.GAR_LOCATION }}/testing-api:latest |
| 80 | + docker tag ${{ env.GAR_LOCATION }}/testing-api:latest Eppo-exp/testing-api:latest |
| 81 | +
|
| 82 | + - name: Run tests |
| 83 | + run: | |
| 84 | + pushd package-testing/sdk-test-runner |
| 85 | + ./test-sdk.sh server ${SDK_NAME} |
| 86 | + popd |
| 87 | +
|
| 88 | + - name: Upload Logs |
| 89 | + if: success() || failure() # always run even if the previous steps fail |
| 90 | + |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: ${{ steps.date.outputs.date }}-${{ env.SAFE_SDK_NAME }}-${{ inputs.platform }}-test-logs |
| 94 | + path: package-testing/sdk-test-runner/logs/ |
| 95 | + |
| 96 | + - name: Publish Test Report |
| 97 | + uses: mikepenz/action-junit-report@v5 |
| 98 | + if: success() || failure() # always run even if the previous steps fail |
| 99 | + with: |
| 100 | + report_paths: 'package-testing/sdk-test-runner/logs/results.xml' |
0 commit comments