aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/build_and_test.yml
blob: 94d94541e1d7408963689c979e08780253af4f4c (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
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Build-and-Test

on:
  workflow_call:
    inputs:
      runner_label:
        required: true
        type: string
      sanitizer:
        required: false
        type: string
      test_label_regexp:
        required: false
        type: string
    
jobs:
  main:

    runs-on: [ self-hosted, "${{ inputs.runner_label }}" ]
    
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Configure for sanitizer
      shell: bash
      if: startsWith(inputs.sanitizer,'sanitize=')
      run: |
        mkdir -p ../build
        patch -p1 < ydb/deploy/patches/0001-sanitizer-build.patch
        cd ../build
        rm -rf *
        cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain -DCMAKE_CXX_FLAGS="${{ matrix.sanitizer }} -fno-omit-frame-pointer" -DCMAKE_C_FLAGS="${{ matrix.sanitizer }} -fno-omit-frame-pointer" ../ydb
    - name: Configure
      shell: bash
      if: false == startsWith(inputs.sanitizer,'sanitize=')
      run: |
        mkdir -p ../build
        cd ../build
        rm -rf *
        cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain ../ydb
    - name: Build
      shell: bash
      run: |
        cd ../build
        ninja
    - name: Test
      continue-on-error: true
      shell: bash
      run: |
        cd ../build/ydb
        rm -rf $(pwd)/../../tmp/*
        rm -rf $(pwd)/../../test_reports/*
        mkdir -p ../../artifacts
        rm -rf $(pwd)/../../artifacts/*
        
        # Sed removes coloring from the output
        TMPDIR=$(pwd)/../../tmp GTEST_OUTPUT="xml:$(pwd)/../../test_reports/" \
          ctest -j28 --timeout 1200 --force-new-ctest-process --output-on-failure \
                --output-junit $(pwd)/../../test_reports/ctest_report.xml \
                -L ${{inputs.test_label_regexp}} | \
          sed -e 's/\x1b\[[0-9;]*m//g' | \
          tee >(gzip --stdout > ../../artifacts/${{inputs.runner_label}}-${{inputs.sanitizer}}-stdout.gz) | \
          grep -E '(Test\s*#.*\*\*\*|\[FAIL\])|.*tests passed,.*tests failed out of' | \
          tee -a $GITHUB_STEP_SUMMARY
        echo "Stdout log (gzip archive): https://storage.yandexcloud.net/ydb-tech-ci/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{inputs.runner_label}}-${{inputs.sanitizer}}-stdout.gz" >> $GITHUB_STEP_SUMMARY
    - name: Upload S3
      uses: shallwefootball/s3-upload-action@master
      if: always()
      with:
        aws_key_id: ${{ secrets.AWS_KEY_ID }}
        aws_secret_access_key: ${{ secrets.AWS_KEY_VALUE}}
        aws_bucket: ydb-tech-ci
        source_dir: ../artifacts
        destination_dir: '${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}'
        endpoint: https://storage.yandexcloud.net