diff options
author | Bulat Gayazov <brgayazov@yandex-team.ru> | 2023-05-15 18:07:20 +0000 |
---|---|---|
committer | brgayazov <bulat@ydb.tech> | 2023-05-15 21:07:20 +0300 |
commit | 30262aec29ed4f7de7e4fee1bf0da23b8d22960e (patch) | |
tree | 7dbf6c484701c42844c8eae1c6bd8cd85de4c30f | |
parent | 72b6ed8df07bf2a4c960a4fb117c3017c686ea73 (diff) | |
download | ydb-30262aec29ed4f7de7e4fee1bf0da23b8d22960e.tar.gz |
Added functional tests to CI
Added functional tests to CI
Pull Request resolved: #205
-rw-r--r-- | .github/actions/test/action.yml | 21 | ||||
-rw-r--r-- | .github/actions/test_python/action.yml | 52 | ||||
-rw-r--r-- | .github/workflows/build_and_test_ondemand.yml | 32 | ||||
-rw-r--r-- | .github/workflows/build_and_test_provisioned.yml | 27 | ||||
-rw-r--r-- | .github/workflows/prepare_vm_for_build.yml | 4 |
5 files changed, 116 insertions, 20 deletions
diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index aa88ac7d95..57e46eacdb 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -14,15 +14,18 @@ inputs: required: true type: string testman_token: - required: false - type: string + required: false + type: string testman_url: - required: false - type: string + required: false + type: string testman_project_id: - required: false - type: string - + required: false + type: string + aws_bucket: + required: true + type: string + runs: using: "composite" steps: @@ -36,7 +39,7 @@ runs: echo "TESTREPDIR=$(pwd)/test_reports" >> $GITHUB_ENV echo "TESTMO_TOKEN=${{inputs.testman_token}}" >> $GITHUB_ENV echo "TESTMO_URL=${{inputs.testman_url}}" >> $GITHUB_ENV - echo "logfilename=${{inputs.log_suffix}}-stdout.gz" >> $GITHUB_OUTPUT + echo "logfilename=${{inputs.log_suffix}}-ctest-stdout.gz" >> $GITHUB_OUTPUT - name: Install Node required for Testmo CLI uses: actions/setup-node@v3 with: @@ -91,7 +94,7 @@ runs: with: aws_key_id: ${{inputs.AWS_KEY_ID }} aws_secret_access_key: ${{inputs.AWS_KEY_VALUE}} - aws_bucket: ydb-tech-ci + aws_bucket: ${{inputs.aws_bucket}} source_dir: artifacts destination_dir: '${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}' endpoint: https://storage.yandexcloud.net diff --git a/.github/actions/test_python/action.yml b/.github/actions/test_python/action.yml new file mode 100644 index 0000000000..353622359c --- /dev/null +++ b/.github/actions/test_python/action.yml @@ -0,0 +1,52 @@ +name: test-python +description: Run functional Python tests +inputs: + log_suffix: + required: true + type: string + test_label_regexp: + required: false + type: string + aws_key_id: + required: true + type: string + aws_key_value: + required: true + type: string + aws_bucket: + required: true + type: string + +runs: + using: "composite" + steps: + - name: Test + shell: bash + run: | + export source_root=$(pwd) + export build_root=$(pwd)/../build/ + mkdir -p ../artifacts + rm -rf ../artifacts/* + source ${source_root}/ydb/tests/oss/launch/prepare.sh + + echo "Stdout log (gzip archive): https://storage.yandexcloud.net/ydb-tech-ci/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{inputs.log_suffix}}-${{inputs.sanitizer}}-stdout.gz" >> $GITHUB_STEP_SUMMARY + cd ${source_root}/ydb/tests/functional/ + export suite='' + if [[ "${{inputs.test_label_regexp}}" != "" ]]; then + suite="--suite ${{inputs.test_label_regexp}}" + fi + python ${source_root}/ydb/tests/oss/launch/launch.py --test-dir ${source_root}/ydb/tests/functional \ + --xml-dir ${source_root}/ydb/tests/functional/test-results/xml $suite | \ + sed -e 's/\x1b\[[0-9;]*m//g' | \ + tee >(gzip --stdout > ${source_root}/../artifacts/${{inputs.log_suffix}}-pytest-stdout.gz) | \ + tee -a $GITHUB_STEP_SUMMARY + - name: Upload S3 + uses: shallwefootball/s3-upload-action@master + if: always() + with: + aws_key_id: ${{inputs.aws_key_id}} + aws_secret_access_key: ${{inputs.aws_key_value}} + aws_bucket: ${{inputs.aws_bucket}} + source_dir: ../artifacts + destination_dir: '${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}' + endpoint: https://storage.yandexcloud.net diff --git a/.github/workflows/build_and_test_ondemand.yml b/.github/workflows/build_and_test_ondemand.yml index eb5e54923e..0748dc5bb0 100644 --- a/.github/workflows/build_and_test_ondemand.yml +++ b/.github/workflows/build_and_test_ondemand.yml @@ -12,7 +12,13 @@ on: image: type: string required: false - default: fd8snjpoq85qqv0mk9gi + default: fd8earpjmhevh8h6ug5o + run_unit_tests: + type: boolean + default: true + run_functional_tests: + type: boolean + default: false workflow_dispatch: inputs: sanitizer: @@ -24,7 +30,13 @@ on: image: type: string required: false - default: fd8snjpoq85qqv0mk9gi + default: fd8earpjmhevh8h6ug5o + run_unit_tests: + type: boolean + default: true + run_functional_tests: + type: boolean + default: true jobs: @@ -78,19 +90,31 @@ jobs: uses: actions/checkout@v3 if: github.event.pull_request.head.sha == '' - name: Build + id: build uses: ./.github/actions/build with: sanitizer: ${{ inputs.sanitizer }} - - name: Test + - name: Run unit tests + if: inputs.run_unit_tests uses: ./.github/actions/test - with: + with: log_suffix: ${{format('{0}{1}', 'X64', inputs.sanitizer)}} test_label_regexp: ${{ inputs.test_label_regexp }} aws_key_id: ${{secrets.AWS_KEY_ID}} aws_key_value: ${{secrets.AWS_KEY_VALUE}} + aws_bucket: ${{secrets.AWS_BUCKET}} testman_token: ${{secrets.TESTMO_TOKEN}} testman_url: ${{vars.TESTMO_URL}} testman_project_id: ${{vars.TESTMO_PROJECT_ID}} + - name: Run functional tests + if: inputs.run_functional_tests && (success() || failure()) && steps.build.conclusion != 'failure' + uses: ./.github/actions/test_python + with: + log_suffix: ${{format('{0}-{1}', 'X64', inputs.sanitizer)}} + test_label_regexp: ${{ inputs.test_label_regexp }} + aws_key_id: ${{secrets.AWS_KEY_ID}} + aws_key_value: ${{secrets.AWS_KEY_VALUE}} + aws_bucket: ${{secrets.AWS_BUCKET}} release-runner: name: Release self-hosted YC runner if provided on-demand diff --git a/.github/workflows/build_and_test_provisioned.yml b/.github/workflows/build_and_test_provisioned.yml index 3af5be215a..e27af3ecbd 100644 --- a/.github/workflows/build_and_test_provisioned.yml +++ b/.github/workflows/build_and_test_provisioned.yml @@ -12,9 +12,12 @@ on: sanitizer: required: false type: string - run_tests: + run_unit_tests: type: boolean default: true + run_functional_tests: + type: boolean + default: false test_label_regexp: required: false type: string @@ -29,7 +32,10 @@ on: sanitizer: required: false type: string - run_tests: + run_unit_tests: + type: boolean + default: true + run_functional_tests: type: boolean default: true test_label_regexp: @@ -48,14 +54,25 @@ jobs: if: inputs.run_build with: sanitizer: ${{ inputs.sanitizer }} - - name: Test + - name: Run unit tests uses: ./.github/actions/test - if: inputs.run_tests + if: inputs.run_unit_tests with: - log_suffix: ${{format('{0}{1}', inputs.runner_label, inputs.sanitizer)}} + log_suffix: ${{format('{0}{1}{2}', inputs.runner_label, inputs.sanitizer, 'unit')}} test_label_regexp: ${{ inputs.test_label_regexp }} aws_key_id: ${{secrets.AWS_KEY_ID}} aws_key_value: ${{secrets.AWS_KEY_VALUE}} + aws_bucket: ${{secrets.AWS_BUCKET}} testman_token: ${{secrets.TESTMO_TOKEN}} testman_url: ${{vars.TESTMO_URL}} testman_project_id: ${{vars.TESTMO_PROJECT_ID}} + - name: Run functional tests + if: inputs.run_functional_tests && (success() || failure()) && steps.build.conclusion != 'failure' + uses: ./.github/actions/test_python + with: + log_suffix: ${{format('{0}{1}{2}', inputs.runner_label, inputs.sanitizer, 'functional')}} + test_label_regexp: ${{ inputs.test_label_regexp }} + aws_key_id: ${{secrets.AWS_KEY_ID}} + aws_key_value: ${{secrets.AWS_KEY_VALUE}} + aws_bucket: ${{secrets.AWS_BUCKET}} + diff --git a/.github/workflows/prepare_vm_for_build.yml b/.github/workflows/prepare_vm_for_build.yml index bfa6d972c3..0cee339c69 100644 --- a/.github/workflows/prepare_vm_for_build.yml +++ b/.github/workflows/prepare_vm_for_build.yml @@ -27,8 +27,8 @@ jobs: echo "deb http://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null sudo apt-get update - sudo apt-get -y install git cmake python3-pip ninja-build antlr3 m4 clang-12 lld-12 libidn11-dev libaio1 libaio-dev - sudo pip3 install conan==1.59 + sudo apt-get -y install python-is-python3 git cmake python3-pip ninja-build antlr3 m4 clang-12 lld-12 libidn11-dev libaio1 libaio-dev + sudo pip3 install conan==1.59 pytest==7.1.3 grpcio grpcio-tools PyHamcrest tornado xmltodict pyarrow - name: Install AllureCtl if: false shell: bash |