diff --git a/.github/workflows/L1-tests.yml b/.github/workflows/L1-tests.yml index 0b5cfccd..4f85ca8a 100755 --- a/.github/workflows/L1-tests.yml +++ b/.github/workflows/L1-tests.yml @@ -2,6 +2,11 @@ name: L1-tests on: workflow_call: + inputs: + caller_source: + description: "Specifies the source type (e.g., local or test framework) for the workflow." + required: true + type: string secrets: RDKCM_RDKE: required: true @@ -69,6 +74,7 @@ jobs: - name: ACK External Trigger run: | echo "Message: External Trigger Received for L1 Tests" + echo "Trigger Source: ${{ inputs.caller_source }}" - name: Set up CMake uses: jwlawson/actions-setup-cmake@v1.13 @@ -121,6 +127,13 @@ jobs: token: ${{ secrets.RDKCM_RDKE }} - name: Checkout entservices-inputoutput + if: ${{ inputs.caller_source == 'local' }} + uses: actions/checkout@v3 + with: + path: entservices-inputoutput + + - name: Checkout entservices-inputoutput-testframework + if: ${{ inputs.caller_source == 'testframework' }} uses: actions/checkout@v3 with: repository: rdkcentral/entservices-inputoutput diff --git a/.github/workflows/L2-tests.yml b/.github/workflows/L2-tests.yml index 9dc033be..70b3894a 100755 --- a/.github/workflows/L2-tests.yml +++ b/.github/workflows/L2-tests.yml @@ -2,6 +2,11 @@ name: L2-tests on: workflow_call: + inputs: + caller_source: + description: "Specifies the source type (e.g., local or test framework) for the workflow." + required: true + type: string secrets: RDKCM_RDKE: required: true @@ -39,6 +44,7 @@ jobs: - name: ACK External Trigger run: | echo "Message: External Trigger Received for L2 Tests" + echo "Trigger Source: ${{ inputs.caller_source }}" - name: Set up CMake uses: jwlawson/actions-setup-cmake@v1.13 @@ -83,6 +89,13 @@ jobs: ref: R4.4.3 - name: Checkout entservices-inputoutput + if: ${{ inputs.caller_source == 'local' }} + uses: actions/checkout@v3 + with: + path: entservices-inputoutput + + - name: Checkout entservices-inputoutput-testframework + if: ${{ inputs.caller_source == 'testframework' }} uses: actions/checkout@v3 with: repository: rdkcentral/entservices-inputoutput diff --git a/.github/workflows/tests-trigger.yml b/.github/workflows/tests-trigger.yml index 3aa84f0f..bb3de6af 100755 --- a/.github/workflows/tests-trigger.yml +++ b/.github/workflows/tests-trigger.yml @@ -11,11 +11,14 @@ on: jobs: trigger-L1: uses: ./.github/workflows/L1-tests.yml + with: + caller_source: local secrets: RDKCM_RDKE: ${{ secrets.RDKCM_RDKE }} trigger-L2: uses: ./.github/workflows/L2-tests.yml + with: + caller_source: local secrets: RDKCM_RDKE: ${{ secrets.RDKCM_RDKE }} - diff --git a/Tests/README.md b/Tests/README.md index 4b6eb4ac..48e14c27 100644 --- a/Tests/README.md +++ b/Tests/README.md @@ -6,30 +6,20 @@ Hence, any modifications/additions related to mocks should be commited to entser # Individual Repo Handling Each individual entservices-* repo was added with a .yml file to trigger L1, L2, L2-OOP test job in github workflow. This yml file triggers below mentioned build jobs in addition to regular build jobs (thunder, thunder tools & etc,). - +``` a/ Build mocks => To create TestMock Lib from all required mock relates stubs and copy to install/usr/lib path. b/ Build entservices- => To create Test Lib of .so type from all applicable test files which are enabled for plugin test. c/ Build entservices-testframework => To create L1/L2 executable by linking the plugins/test .so files. - +``` This ensures everything in-tact in repo level across multiple related plugins when there is a new change comes in. -# testframework Repo Handling -The entservices-testframework repo contains yml files corresponds to L1, L2 & L2-OOP to trigger test job in github workflow. - -This yml file triggers below mentioned build jobs in addition to regular build jobs (thunder, thunder tools & etc,). - -a/ Build mocks => To create TestMock Lib from all required mock relates stubs and copy to install/usr/lib path. -b/ Build entservices-* => Jobs to checkout/build all individual repo's plugin & test files which are enabled for plugin test and copy all required libs to install/usr/lib path. -c/ Build entservices-testframework => To create L1/L2 executable by linking the plugins/test .so files. - -This ensures everything in-tact across multiple repos when there is a new change comes either in mocks or test case or plugins. - ##### Steps to run L1, L2, L2-OOP test locally ##### +``` 1. checkout the entservices- to your working directory in your build machine. -example: git clone https://github.com/rdkcentral/entservices-testframework.git +example: git clone https://github.com/rdkcentral/entservices-deviceanddisplay.git 2. switch to entservices- directory -example: cd entservices-testframework +example: cd entservices-deviceanddisplay 3. check and ensure current working branch points to develop example: git branch @@ -37,18 +27,33 @@ example: git branch 4. Run below curl command to download act executable to your repo. example: curl -SL https://raw.githubusercontent.com/nektos/act/master/install.sh | bash -5. 5a/to run L1 test -example: ./bin/act -W .github/workflows/L1-tests.yml -s GITHUB_TOKEN= +5. Run L1, L2, L2-oop test +example: ./bin/act -W .github/workflows/tests-trigger.yml -s GITHUB_TOKEN= -5. 5b/to run L2 test -example: ./bin/act -W .github/workflows/L2-tests.yml -s GITHUB_TOKEN= - -5. 5c/to run L2 test OOP -example: ./bin/act -W .github/workflows/L2-tests-oop.yml -s GITHUB_TOKEN= +NOTE: By default test-trigger.yml will trigger all tests(L1, L2 and etc) parallely, if you want any one test alone to be triggered/verified then remove the other trigger rules from the tests-trigger.yml +``` +# testframework Repo Handling +tf-trigger.yml file of testframework repo will get loaded into github action whenever there is a pull or push happens. This file in-turn triggers all individual repos L1, L2, L2-oop tests. testframework repo test can run only in github workflow. -NOTES: -a/ If you face any secret token related error while run your yml, pls comment the below mentioned line +NOTE: +If you face any secret token related error while run your yml, pls comment the below mentioned line #token: ${{ secrets.RDKE_GITHUB_TOKEN }} -b/ Coverage Report of both L1 and L2 test are uploaded to artifacts server. -c/ For the case, which has modification in plugin and/or test files as well in entservices-testframework mock files, change the ref key of checkout job to point your own branch instead of develop, in both entservices-testframework and entservices-* repo and ensure L1, L2, L2-OOP test jobs are passing for your PR. -example: ref: feature/L1-test + +# Execution usecases where manual change required before triggering the test: +``` +a/ changes in testframework repo only: +Need to change ref pointer of "Checkout entservices-testframework" job in individual repo yml file, to point your current working branch of testframework and in tftrigger.yml of testframework repo need to change trigger branch name to your individual repo branch name instead of develop which is default. +example: +ref: topic/method_1 /* Checkout entservices-testframework job */ +uses: rdkcentral/entservices-deviceanddisplay/.github/workflows/L1-tests.yml@topic/method_1 /* tf-trigger.yml */ + +b/ changes in both testframework repo and invidual repo: +Changes mentioned in step (a) above + "Checkout entservices-deviceanddisplay-testframework" job in individual repo yml file, ref field to point your deviceanddisplay current working branch. +example: +ref: topic/method_1 /* Checkout entservices-testframework job */ +ref: topic/method_1 /* Checkout entservices-deviceanddisplay-testframework job */ +uses: rdkcentral/entservices-deviceanddisplay/.github/workflows/L1-tests.yml@topic/method_1 /* tf-trigger.yml */ + +c/ changes in individual entservices-* repo only +no changes required +```