Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quality: Round 2 of SDK test workflow migrations #58

Merged
merged 30 commits into from
Aug 30, 2024
Merged

Conversation

typotter
Copy link
Collaborator

@typotter typotter commented Aug 20, 2024

🎟️ Fixes FF-3088 towards FF-3085

πŸ‘―β€β™‚οΈ Related PRs

Motivation

Changes are often made to the sdk-test-data repository to capture new behaviours, bugs and edge cases. When these changes are pushed to main, the SDKs are cloned locally (locally to the github action running) and their respective tests are run. These tests are set up and run by copies of the SDK test workflows - see sdk-test-data workflow. There are a number of limitations to this setup:

  • Test steps are copied from the SDK’s respective workflows; changes to the SDK test workflows need to be replicated in sdk-test-data and this is not obvious to devs
  • The SDK tests are not able to run against in-flight changes to sdk-test-data
  • When new test-data is committed that breaks an SDK, that breakage is not surfaced in the SDK’s repository until some action triggers its testing workflow (on demand, on pull-request, etc.).

Description of Changes

This change
πŸš€ - Each SDK's testing workflow is enhanced into a reusable workflow, exposing parameters for SDK branch and the sdk-test-data branch to use in testing.

  • The test workflow runs using the main branch of sdk-test-data on all main pushes and Pull Requests using the PR's branch

External to this Change
sdk-test-data get two testing workflows.

  1. ♻️ "Local Testing"- For all pull request changes, the "Local Testing" workflow calls the reusable SDK workflows, test results are recorded only in the sdk-test-data action. This is run using the main SDK branch and the "current" branch of workflow, i.e. the pull request branch. (SDK repo does not see/is not notified of test failures during PR lifecycle, only on push to main)
  2. ♻️ πŸ§‘β€πŸ’» "Remote Testing" - On all pushes to the main branch of sdk-test-data, the SDK testing workflows are triggered to run within their respective repositories, alerting all subscribers of failed runs (repo is red/green).

@typotter typotter marked this pull request as ready for review August 29, 2024 04:39
@@ -1,4 +1,5 @@
name: Test SDKs Locally
name: Test SDKs Locally
Copy link
Contributor

@greghuels greghuels Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this line was duplicated by accident

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the catch; late night merges...

Copy link
Contributor

@aarsilv aarsilv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as-is, but I'd consider using a matrix to simplify/consolidate things

@@ -4,9 +4,30 @@ on:
push:
branches:
- main
- tp/workflows/round2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporary I'm guessing?

What about running these shared tests on all pull requests, like we do for the individual SDKs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test-sdks.yml is for in-flight changes; we don't want to make the SDKs in their respective repos until the test cases are checked in.

Temporary indeed; removed.

workflow_dispatch:

jobs:

test-java-sdk:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lots of duplicated code, have you considered using a matrix?

Unchecked example from ChatGPT:

test-sdks:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        sdk:
          - { repo: "java-server-sdk", workflow: "lint-test-sdk.yml", ref: "tp/workflows/remote" }
          - { repo: "php-sdk", workflow: "run-tests.yml", ref: "main" }
          - { repo: "js-client-sdk", workflow: "lint-test-sdk.yml", ref: "tp/workflows/remote" }
          - { repo: "python-sdk", workflow: "lint-test-sdk.yml", ref: "tp/workflows/remote" }
    steps:
    - name: Display workflow details
      shell: bash
      run: |
        echo "Testing eppo-exp/${{ matrix.sdk.repo }}"
    - name: Run remote workflow
      uses: convictional/[email protected]
      with:
        owner: Eppo-exp
        repo: ${{ matrix.sdk.repo }}
        workflow_file_name: ${{ matrix.sdk.workflow }}
        ref: ${{ matrix.sdk.ref }}
        github_token: ${{ secrets.AUTH_TOKEN }}
        wait_interval: 10
        propagate_failure: true
        trigger_workflow: true
        wait_workflow: true

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't, in fact. πŸ§‘β€πŸ³

owner: Eppo-exp
repo: java-server-sdk
workflow_file_name: lint-test-sdk.yml
ref: tp/workflows/remote
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you merge these first I imagine you won't need this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's right; will remove these refs after SDK PRs are merged

uses: 'google-github-actions/setup-gcloud@v0'
- name: Run tests
run: make test
uses: Eppo-exp/java-server-sdk/.github/workflows/lint-test-sdk.yml@tp/workflows/remote
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the eventual plan to remove this file and just use test-sdks-remote?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the remote workflow is to trigger the tests to run in the respective SDK repos, effectively turning them red when the test data causes a test failure. The test-sdks.yml runs the SDK tests but in the sdk-test-data repo, so it doesn't cause spurious notifications from the repos.

@aarsilv aarsilv assigned typotter and unassigned aarsilv Aug 30, 2024
@typotter typotter merged commit fd4cc8a into main Aug 30, 2024
21 of 22 checks passed
@typotter typotter deleted the tp/workflows/round2 branch August 30, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants