[PSM Interop] Add unittests CI with github actions #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PSM Interop | |
on: | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
unittest: | |
runs-on: ubuntu-latest | |
permissions: | |
# Used by paths-filter to get the diff. | |
pull-requests: read | |
defaults: | |
run: | |
working-directory: 'tools/run_tests/xds_k8s_test_driver' | |
steps: | |
- uses: actions/checkout@v3 | |
# To add this job to required GitHub checks, it's not enough to use | |
# the on.pull_request.paths filter. For required checks, the job needs to | |
# return the success status, and not be skipped. | |
# Using paths-filter action, we skip the setup/test steps when psm interop | |
# files are unchanged, and the job returns success. | |
- uses: dorny/paths-filter@v2 | |
id: paths_filter | |
with: | |
filters: | | |
psm_interop_src: | |
- 'tools/run_tests/xds_k8s_test_driver/**' | |
- 'src/proto/grpc/testing/empty.proto' | |
- 'src/proto/grpc/testing/messages.proto' | |
- 'src/proto/grpc/testing/test.proto' | |
- uses: actions/setup-python@v4 | |
if: ${{ steps.paths_filter.outputs.psm_interop_src == 'true' }} | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
cache-dependency-path: 'tools/run_tests/xds_k8s_test_driver/requirements.lock' | |
- name: "Install requirements" | |
if: ${{ steps.paths_filter.outputs.psm_interop_src == 'true' }} | |
run: | | |
pip list | |
pip install -r requirements.lock | |
pip list | |
- name: "Generate protos" | |
if: ${{ steps.paths_filter.outputs.psm_interop_src == 'true' }} | |
run: > | |
python -m grpc_tools.protoc --proto_path=../../../ | |
--python_out=. --grpc_python_out=. | |
src/proto/grpc/testing/empty.proto | |
src/proto/grpc/testing/messages.proto | |
src/proto/grpc/testing/test.proto | |
- name: "Run unit tests" | |
if: ${{ steps.paths_filter.outputs.psm_interop_src == 'true' }} | |
run: python -m tests.unit |