diff --git a/.github/workflows/lint-test-sdk.yml b/.github/workflows/lint-test-sdk.yml index a097dec..364424e 100644 --- a/.github/workflows/lint-test-sdk.yml +++ b/.github/workflows/lint-test-sdk.yml @@ -4,11 +4,37 @@ on: paths: - '**/*' + 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: + SDK_BRANCH_NAME: ${{ inputs.sdk_branch || github.head_ref || github.ref_name || 'main' }} + TEST_DATA_BRANCH_NAME: ${{ inputs.test_data_branch || 'main' }} + jobs: lint-test-sdk: runs-on: ubuntu-latest steps: + - name: Display Testing Details + run: | + echo "Running SDK Test using" + echo "Test Data: sdk-test-data@${TEST_DATA_BRANCH_NAME}" + echo "SDK Branch: js-client-sdk@${SDK_BRANCH_NAME}" - uses: actions/checkout@v2 + with: + repository: Eppo-exp/js-client-sdk + ref: ${{ env.SDK_BRANCH_NAME }} - name: Use Node.js uses: actions/setup-node@v1 with: @@ -17,8 +43,6 @@ jobs: with: path: './node_modules' key: ${{ runner.os }}-root-node-modules-${{ hashFiles('./yarn.lock') }} - - name: 'Set up GCP SDK for downloading test data' - uses: 'google-github-actions/setup-gcloud@v0' - name: Install SDK dependencies run: yarn --frozen-lockfile working-directory: ./ @@ -26,12 +50,15 @@ jobs: run: npx eslint '**/*.{ts,tsx}' working-directory: ./ - name: Run tests - run: yarn test + run: make test branchName=${{ env.TEST_DATA_BRANCH_NAME }} working-directory: ./ typecheck: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + repository: Eppo-exp/js-client-sdk + ref: ${{ env.SDK_BRANCH_NAME }} - name: Use Node.js uses: actions/setup-node@v1 with: diff --git a/Makefile b/Makefile index c77f1ef..c23789b 100644 --- a/Makefile +++ b/Makefile @@ -45,3 +45,8 @@ prepare: test-data yarn tsc yarn webpack yarn api-extractor run --local + +## test +.PHONY: test +test: test test-data + yarn test:unit \ No newline at end of file