aboutsummaryrefslogtreecommitdiffstats
path: root/.github/actions/test_python/action.yml
blob: f195e408f225fb8c9b754e0ab79a362d3d496ed6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
  aws_endpoint:
    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/*

      echo "Stdout log (gzip archive): https://storage.yandexcloud.net/${{inputs.aws_bucket}}/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{inputs.log_suffix}}-${{inputs.sanitizer}}-pytest-stdout.gz" >> $GITHUB_STEP_SUMMARY
      cd ${source_root}/ydb/tests/functional/
      bad_suites=$(grep -Eo 'ignore=[a-zA-Z_-]*' pytest.ini | sed -e 's/ignore=//g')
      suites=""
      for suite in $(echo */ | sed -e 's/\///g'); do
        if [[ $(echo "$bad_suites" | grep -F -e $suite -) == '' ]]; then
            suites+=$suite
            suites+=$'\n'
        fi
      done
      if [[ "${{inputs.test_label_regexp}}" != '' ]]; then
        suites="${{inputs.test_label_regexp}}"
      fi
      source ${source_root}/ydb/tests/oss/launch/prepare.sh
      echo -n "$suites" | parallel -j32 "pytest -o junit_logging=log -o junit_log_passing_tests=False \
        -v --junit-xml=${source_root}/ydb/tests/functional/test-results/xml/{}/res.xml {}" | \
        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: ${{inputs.aws_endpoint}}