diff --git a/.github/actions/action-test/action.yml b/.github/actions/action-test/action.yml new file mode 100644 index 0000000..4eb5c4a --- /dev/null +++ b/.github/actions/action-test/action.yml @@ -0,0 +1,46 @@ +name: 'Test SDK' +description: 'Unit and Universal Tests' +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 + default: main + +runs: + using: composite + steps: + - name: Display Testing Details + shell: bash + run: | + echo "Running SDK Test using" + echo "Test Data: sdk-test-data@${TEST_DATA_BRANCH_NAME}" + echo "SDK Branch: python-sdk@${SDK_BRANCH_NAME}" + env: + SDK_BRANCH_NAME: ${{ inputs.sdk_branch }} + TEST_DATA_BRANCH_NAME: ${{ inputs.test_data_branch }} + + - uses: "actions/checkout@v2" + with: + repository: Eppo-exp/python-sdk + ref: ${{ inputs.sdk_branch }} + - uses: "actions/setup-python@v2" + with: + python-version: '3.9.x' + - name: "Install dependencies" + shell: bash + run: | + python -VV + python -m pip install --upgrade pip setuptools wheel + python -m pip install -r requirements.txt + python -m pip install -r requirements-test.txt + - name: "Run tests" + shell: bash + run: make test branchName=$BRANCH + env: + BRANCH: ${{ inputs.test_data_branch }} diff --git a/.github/workflows/test-and-lint-sdk.yml b/.github/workflows/lint-test-sdk.yml similarity index 70% rename from .github/workflows/test-and-lint-sdk.yml rename to .github/workflows/lint-test-sdk.yml index 65faced..b41071b 100644 --- a/.github/workflows/test-and-lint-sdk.yml +++ b/.github/workflows/lint-test-sdk.yml @@ -4,6 +4,7 @@ on: pull_request: paths: - '**/*' + workflow_dispatch: jobs: @@ -50,17 +51,6 @@ jobs: run-tests-with-tox: runs-on: ubuntu-latest steps: - - uses: "actions/checkout@v2" - - uses: "actions/setup-python@v2" - with: - python-version: '3.9.x' - - name: "Install dependencies" - run: | - python -VV - python -m pip install --upgrade pip setuptools wheel - python -m pip install -r requirements.txt - python -m pip install -r requirements-test.txt - - name: 'Set up GCP SDK to download test data' - uses: 'google-github-actions/setup-gcloud@v0' - - name: "Run tests" - run: make test + - uses: Eppo-exp/python-sdk/.github/actions/action-test@tp/workflows/remote + with: + sdk_branch: ${{ github.head_ref || github.ref_name }} diff --git a/.gitignore b/.gitignore index db63b3a..8e34a62 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ __pycache__ .tox/ test-data venv/ -.DS_Store \ No newline at end of file +.DS_Store +.venv +.idea