Skip to content

Commit 8cdb2f4

Browse files
authored
quality: parameterize sdk and test data branches (#72)
* quality: parameterize test-and-lint workflow to accept SDK and test data branches
1 parent 694d5b7 commit 8cdb2f4

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

.github/workflows/lint-test-sdk.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,26 @@ on:
77
push:
88
branches: [main]
99

10+
workflow_dispatch:
11+
12+
workflow_call:
13+
inputs:
14+
test_data_branch:
15+
type: string
16+
description: The branch in sdk-test-data to target for testcase files
17+
required: false
18+
default: main
19+
sdk_branch:
20+
type: string
21+
description: The branch of the SDK to test
22+
required: false
23+
1024
env:
1125
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
1226
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
1327
CI: true
28+
SDK_BRANCH: ${{ inputs.sdk_branch || github.head_ref || github.ref_name || 'main' }}
29+
TEST_DATA_BRANCH: ${{ inputs.test_data_branch || 'main' }}
1430

1531
jobs:
1632
lint-test-sdk:
@@ -21,6 +37,8 @@ jobs:
2137
steps:
2238
- uses: actions/checkout@v4
2339
with:
40+
repository: Eppo-exp/sdk-common-jdk
41+
ref: ${{ env.SDK_BRANCH }}
2442
fetch-depth: 0
2543

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

3452
- name: Run tests
35-
run: make test
53+
run: make test branchName=${TEST_DATA_BRANCH}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test-data:
4040
mkdir -p ${tempDir}
4141
git clone -b ${branchName} --depth 1 --single-branch ${githubRepoLink} ${gitDataDir}
4242
cp -r ${gitDataDir}/ufc ${testDataDir}
43-
rm ${testDataDir}/ufc/bandit-tests/*.dynamic-typing.json
43+
rm -f ${testDataDir}/ufc/bandit-tests/*.dynamic-typing.json || true
4444
rm -rf ${tempDir}
4545

4646
.PHONY: test

src/test/java/cloud/eppo/BaseEppoClientTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,14 @@
3939
public class BaseEppoClientTest {
4040
private static final Logger log = LoggerFactory.getLogger(BaseEppoClientTest.class);
4141
private static final String DUMMY_FLAG_API_KEY = "dummy-flags-api-key"; // Will load flags-v1
42-
private static final String TEST_HOST =
42+
43+
// Use branch if specified by env variable `TEST_DATA_BRANCH`.
44+
private static final String TEST_BRANCH = System.getenv("TEST_DATA_BRANCH");
45+
private static final String TEST_HOST_BASE =
4346
"https://us-central1-eppo-qa.cloudfunctions.net/serveGitHubRacTestFile";
47+
private static final String TEST_HOST =
48+
TEST_HOST_BASE + (TEST_BRANCH != null ? "/b/" + TEST_BRANCH : "");
49+
4450
private final ObjectMapper mapper =
4551
new ObjectMapper().registerModule(AssignmentTestCase.assignmentTestCaseModule());
4652

0 commit comments

Comments
 (0)