diff --git a/.github/workflows/lint-test-sdk.yml b/.github/workflows/lint-test-sdk.yml index be8b74f..a3596e9 100644 --- a/.github/workflows/lint-test-sdk.yml +++ b/.github/workflows/lint-test-sdk.yml @@ -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: @@ -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 }} @@ -32,4 +50,4 @@ jobs: gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} - name: Run tests - run: make test + run: make test branchName=${TEST_DATA_BRANCH} diff --git a/Makefile b/Makefile index f5041c8..2f0a787 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/src/test/java/cloud/eppo/BaseEppoClientTest.java b/src/test/java/cloud/eppo/BaseEppoClientTest.java index 6547268..8b9916d 100644 --- a/src/test/java/cloud/eppo/BaseEppoClientTest.java +++ b/src/test/java/cloud/eppo/BaseEppoClientTest.java @@ -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());