From 7f91f90b3a60a2e9300538eab9f5f04e367f1db8 Mon Sep 17 00:00:00 2001 From: linglp Date: Tue, 27 Aug 2024 12:40:13 -0400 Subject: [PATCH] include api test in workflow --- .github/workflows/api_test.yml | 35 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/api_test.yml b/.github/workflows/api_test.yml index 354cbe3ba..db11da69f 100644 --- a/.github/workflows/api_test.yml +++ b/.github/workflows/api_test.yml @@ -4,15 +4,26 @@ name: Test schematic API on: - workflow_dispatch: - inputs: - perform_benchmarking: - required: true - type: boolean - description: perform benchmarking test (True) or skip (False) + push: + branches: ['main'] + pull_request: + branches: ['*'] + workflow_dispatch: # Allow manually triggering the workflow +concurrency: + # cancel the current running workflow from the same branch, PR when a new workflow is triggered + # when the trigger is not a PR but a push, it will use the commit sha to generate the concurrency group + # {{ github.workflow }}: the workflow name is used to generate the concurrency group. This allows you to have more than one workflows + # {{ github.ref_type }}: the type of Git ref object created in the repository. Can be either branch or tag + # {{ github.event.pull_request.number}}: get PR number + # {{ github.sha }}: full commit sha + # credit: https://github.com/Sage-Bionetworks-Workflows/sagetasks/blob/main/.github/workflows/ci.yml + group: >- + ${{ github.workflow }}-${{ github.ref_type }}- + ${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true jobs: - test: + api-test: runs-on: ubuntu-latest env: POETRY_VERSION: 1.3.0 @@ -63,20 +74,18 @@ jobs: #---------------------------------------------- # run API test suite #---------------------------------------------- - - name: Run all API tests + - name: Run all API tests, excluding submission and benchmarks env: SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }} SERVICE_ACCOUNT_CREDS: ${{ secrets.SERVICE_ACCOUNT_CREDS }} - if: ${{ inputs.perform_benchmarking }} run: > source .venv/bin/activate; - pytest -m "schematic_api and not submission" + pytest --durations=0 -m "schematic_api and not submission and not rule_benchmark" - - name: Run API tests + Exclude Benchmarks + - name: Run all submission tests env: SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }} SERVICE_ACCOUNT_CREDS: ${{ secrets.SERVICE_ACCOUNT_CREDS }} - if: ${{ false == inputs.perform_benchmarking }} run: > source .venv/bin/activate; - pytest -m "schematic_api and not submission and not rule_benchmark" + pytest -m "submission"