From 60bea961c9263f33291b7f6b26a20d8f97465603 Mon Sep 17 00:00:00 2001 From: Ty Potter Date: Wed, 21 Aug 2024 10:16:05 -0600 Subject: [PATCH 1/8] Extract action --- .github/actions/action-test/action.yml | 46 +++++++++++++++++++++++++ .github/workflows/test-and-lint-sdk.yml | 17 ++------- .gitignore | 4 ++- 3 files changed, 52 insertions(+), 15 deletions(-) create mode 100644 .github/actions/action-test/action.yml 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/test-and-lint-sdk.yml index 65faced..dc15891 100644 --- a/.github/workflows/test-and-lint-sdk.yml +++ b/.github/workflows/test-and-lint-sdk.yml @@ -50,17 +50,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 || 'main' }} 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 From 53826c9dc4d81448eff956630ff752beebd3d3ea Mon Sep 17 00:00:00 2001 From: Ty Potter Date: Wed, 21 Aug 2024 10:23:19 -0600 Subject: [PATCH 2/8] allow main test workflow to be callable --- .github/workflows/test-and-lint-sdk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-lint-sdk.yml b/.github/workflows/test-and-lint-sdk.yml index dc15891..b525e91 100644 --- a/.github/workflows/test-and-lint-sdk.yml +++ b/.github/workflows/test-and-lint-sdk.yml @@ -4,6 +4,7 @@ on: pull_request: paths: - '**/*' + workflow_call: jobs: From 317e719ba177807b9c015ed6f7092c683c29018f Mon Sep 17 00:00:00 2001 From: Ty Potter Date: Wed, 21 Aug 2024 10:27:19 -0600 Subject: [PATCH 3/8] consistent workflow name --- .github/workflows/{test-and-lint-sdk.yml => lint-test-sdk.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test-and-lint-sdk.yml => lint-test-sdk.yml} (100%) diff --git a/.github/workflows/test-and-lint-sdk.yml b/.github/workflows/lint-test-sdk.yml similarity index 100% rename from .github/workflows/test-and-lint-sdk.yml rename to .github/workflows/lint-test-sdk.yml From 4775dbb22f56c900ad67b675350646e27a4fbcc6 Mon Sep 17 00:00:00 2001 From: Ty Potter Date: Wed, 21 Aug 2024 10:29:12 -0600 Subject: [PATCH 4/8] API uses dispatch, not call --- .github/workflows/lint-test-sdk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-test-sdk.yml b/.github/workflows/lint-test-sdk.yml index b525e91..2133cec 100644 --- a/.github/workflows/lint-test-sdk.yml +++ b/.github/workflows/lint-test-sdk.yml @@ -4,7 +4,7 @@ on: pull_request: paths: - '**/*' - workflow_call: + workflow_dispatch: jobs: From 17c825cea48a29b626e99be9dc7b998f73cd5b9c Mon Sep 17 00:00:00 2001 From: Ty Potter Date: Thu, 29 Aug 2024 08:55:00 -0600 Subject: [PATCH 5/8] relative path --- .github/workflows/lint-test-sdk.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-test-sdk.yml b/.github/workflows/lint-test-sdk.yml index 2133cec..779ad8f 100644 --- a/.github/workflows/lint-test-sdk.yml +++ b/.github/workflows/lint-test-sdk.yml @@ -51,6 +51,6 @@ jobs: run-tests-with-tox: runs-on: ubuntu-latest steps: - - uses: Eppo-exp/python-sdk/.github/actions/action-test@tp/workflows/remote + - uses: .github/actions/action-test with: - sdk_branch: ${{ github.head_ref || github.ref_name || 'main' }} + sdk_branch: ${{ github.head_ref || github.ref_name }} From e907e3c48a0a383dbc4eebb6089c7d71958e5e54 Mon Sep 17 00:00:00 2001 From: Ty Potter Date: Thu, 29 Aug 2024 08:57:42 -0600 Subject: [PATCH 6/8] abs path --- .github/workflows/lint-test-sdk.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-test-sdk.yml b/.github/workflows/lint-test-sdk.yml index 779ad8f..b41071b 100644 --- a/.github/workflows/lint-test-sdk.yml +++ b/.github/workflows/lint-test-sdk.yml @@ -51,6 +51,6 @@ jobs: run-tests-with-tox: runs-on: ubuntu-latest steps: - - uses: .github/actions/action-test + - uses: Eppo-exp/python-sdk/.github/actions/action-test@tp/workflows/remote with: - sdk_branch: ${{ github.head_ref || github.ref_name }} + sdk_branch: ${{ github.head_ref || github.ref_name }} From e10ae06f54d4bcfb4e05e10a838edc0422e84886 Mon Sep 17 00:00:00 2001 From: Ty Potter Date: Thu, 29 Aug 2024 08:58:50 -0600 Subject: [PATCH 7/8] trim params --- .github/workflows/lint-test-sdk.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/lint-test-sdk.yml b/.github/workflows/lint-test-sdk.yml index b41071b..b4c9c9f 100644 --- a/.github/workflows/lint-test-sdk.yml +++ b/.github/workflows/lint-test-sdk.yml @@ -52,5 +52,3 @@ jobs: runs-on: ubuntu-latest steps: - uses: Eppo-exp/python-sdk/.github/actions/action-test@tp/workflows/remote - with: - sdk_branch: ${{ github.head_ref || github.ref_name }} From f8824367740c630b88ef0124287dacc00d72e3b2 Mon Sep 17 00:00:00 2001 From: Ty Potter Date: Thu, 29 Aug 2024 09:00:03 -0600 Subject: [PATCH 8/8] untrim params --- .github/workflows/lint-test-sdk.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/lint-test-sdk.yml b/.github/workflows/lint-test-sdk.yml index b4c9c9f..b41071b 100644 --- a/.github/workflows/lint-test-sdk.yml +++ b/.github/workflows/lint-test-sdk.yml @@ -52,3 +52,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: Eppo-exp/python-sdk/.github/actions/action-test@tp/workflows/remote + with: + sdk_branch: ${{ github.head_ref || github.ref_name }}