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: parameterize sdk and test data branches #72

Merged
merged 6 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/lint-test-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,28 @@ on:
paths:
- '**/*'
push:
branches: [main]
branches: [main, tp/**]

workflow_dispatch:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Used to allow dispatching via web API (remotely triggered test run when changes are made to sdk-test-data)


workflow_call:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Allows specifying branches when used as a reusable workflow

inputs:
test_data_branch:
type: string
description: The branch in sdk-test-data to target for testcase files
required: false
default: main
sdk_branch:
type: string
description: The branch of the SDK to test
required: false

env:
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
CI: true
SDK_BRANCH: ${{ inputs.sdk_branch || github.head_ref || github.ref_name || 'main' }}
TEST_DATA_BRANCH: ${{ inputs.test_data_branch || 'main' }}

jobs:
lint-test-sdk:
Expand All @@ -21,6 +37,8 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
repository: Eppo-exp/sdk-common-jdk
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

explicitly specify the repo and ref otherwise, when run as a reusable workflow in another repo, this would not checkout the java-common SDK as required

ref: ${{ env.SDK_BRANCH }}
fetch-depth: 0

- name: Set up JDK ${{ matrix.java-version }}
Expand All @@ -32,4 +50,4 @@ jobs:
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Run tests
run: make test
run: make test branchName=${TEST_DATA_BRANCH}
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ”₯

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test-data:
mkdir -p ${tempDir}
git clone -b ${branchName} --depth 1 --single-branch ${githubRepoLink} ${gitDataDir}
cp -r ${gitDataDir}/ufc ${testDataDir}
rm ${testDataDir}/ufc/bandit-tests/*.dynamic-typing.json
rm -f ${testDataDir}/ufc/bandit-tests/*.dynamic-typing.json || 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.

bumped into this failing when I was doing some local testing that involved temporarily deleting most of the test data/cases. We shouldn't bump over this in any real scenario but no need to have this fail at any rate

rm -rf ${tempDir}

.PHONY: test
Expand Down
8 changes: 7 additions & 1 deletion src/test/java/cloud/eppo/BaseEppoClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@
public class BaseEppoClientTest {
private static final Logger log = LoggerFactory.getLogger(BaseEppoClientTest.class);
private static final String DUMMY_FLAG_API_KEY = "dummy-flags-api-key"; // Will load flags-v1
private static final String TEST_HOST =

// Use branch if specified by env variable `TEST_DATA_BRANCH`.
private static final String TEST_BRANCH = System.getenv("TEST_DATA_BRANCH");
private static final String TEST_HOST_BASE =
"https://us-central1-eppo-qa.cloudfunctions.net/serveGitHubRacTestFile";
private static final String TEST_HOST =
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_HOST_BASE + (TEST_BRANCH != null ? "/b/" + TEST_BRANCH : "");

private final ObjectMapper mapper =
new ObjectMapper().registerModule(AssignmentTestCase.assignmentTestCaseModule());

Expand Down