Skip to content

Commit

Permalink
quality: parameterize sdk and test data branches (#72)
Browse files Browse the repository at this point in the history
* quality: parameterize test-and-lint workflow to accept SDK and test data branches
  • Loading branch information
typotter authored Dec 3, 2024
1 parent 694d5b7 commit 8cdb2f4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/lint-test-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,26 @@ on:
push:
branches: [main]

workflow_dispatch:

workflow_call:
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
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}
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
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 =
TEST_HOST_BASE + (TEST_BRANCH != null ? "/b/" + TEST_BRANCH : "");

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

Expand Down

0 comments on commit 8cdb2f4

Please sign in to comment.