diff --git a/.github/workflows/perf-test.yml b/.github/workflows/perf-test.yml new file mode 100644 index 0000000..543cb9b --- /dev/null +++ b/.github/workflows/perf-test.yml @@ -0,0 +1,64 @@ +name: Trigger SDK Tests Build + +on: + push: + branches: + - main + workflow_dispatch: + inputs: + sha: + description: 'Git SHA to build (defaults to current HEAD)' + required: false + type: string + +jobs: + trigger-sdk-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get commit SHA + id: get-sha + run: | + if [ -n "${{ github.event.inputs.sha }}" ]; then + echo "sha=${{ github.event.inputs.sha }}" >> $GITHUB_OUTPUT + else + echo "sha=${{ github.sha }}" >> $GITHUB_OUTPUT + fi + + - name: Generate GitHub App token + id: generate-token + uses: peter-murray/workflow-application-token-action@v2 + with: + application_id: ${{ secrets.EVALUATION_PROXY_INTEGRATION_APP_ID }} + application_private_key: ${{ secrets.EVALUATION_PROXY_INTEGRATION_KEY }} + + - name: Trigger sdk-tests workflow + run: | + curl -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ steps.generate-token.outputs.token }}" \ + https://api.github.com/repos/amplitude/sdk-tests/dispatches \ + -d '{ + "event_type": "evaluation-proxy-tests", + "client_payload": { + "sha": "${{ steps.get-sha.outputs.sha }}", + "ref": "${{ github.ref }}", + "repo_url": "${{ github.repositoryUrl }}", + "triggered_by": "${{ github.actor }}", + "workflow_run_id": "${{ github.run_id }}" + } + }' + + - name: Output summary + run: | + echo "## Triggered SDK Tests" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "- **SHA**: ${{ steps.get-sha.outputs.sha }}" >> $GITHUB_STEP_SUMMARY + echo "- **Ref**: ${{ github.ref }}" >> $GITHUB_STEP_SUMMARY + echo "- **Triggered by**: ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "Check the [sdk-tests workflow runs](https://github.com/amplitude/sdk-tests/actions) for build progress." >> $GITHUB_STEP_SUMMARY