blob: 57e46eacdb740980712ee46c29394241a61ed5d5 (
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
name: build-and-test
description: Build YDB and run 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
testman_token:
required: false
type: string
testman_url:
required: false
type: string
testman_project_id:
required: false
type: string
aws_bucket:
required: true
type: string
runs:
using: "composite"
steps:
- name: Init
id: init
shell: bash
run: |
mkdir -p artifacts tmp test_reports
rm -rf artifacts/* tmp/* test_reports/*
echo "WORKDIR=$(pwd)" >> $GITHUB_ENV
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}}-ctest-stdout.gz" >> $GITHUB_OUTPUT
- name: Install Node required for Testmo CLI
uses: actions/setup-node@v3
with:
node-version: 19
- name: Install Testmo CLI
shell: bash
run: npm install -g @testmo/testmo-cli
- name: Test history run create
id: th
if: inputs.testman_token
shell: bash
run: |
RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
testmo automation:resources:add-link --name build --url $RUN_URL --resources testmo.json
testmo automation:resources:add-field --name git-sha --type string --value ${GITHUB_SHA:0:7} --resources testmo.json
testmo automation:run:create --instance "$TESTMO_URL" --project-id ${{inputs.testman_project_id}} --name "${{ github.run_id }}" \
--source "${{inputs.log_suffix}}" --resources testmo.json \
--tags "$GITHUB_REF_NAME" | \
echo "runid=$(cat)" >> $GITHUB_OUTPUT
- name: Test
shell: bash
run: |
cd $WORKDIR/../build/ydb
echo "Stdout log (gzip archive): https://storage.yandexcloud.net/ydb-tech-ci/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{steps.init.outputs.logfilename}}" >> $GITHUB_STEP_SUMMARY
# Sed removes coloring from the output
TMPDIR=$WORKDIR/tmp GTEST_OUTPUT="xml:$TESTREPDIR/unittests/" Y_UNITTEST_OUTPUT="xml:$TESTREPDIR/unittests/" \
ctest -j28 --timeout 1200 --force-new-ctest-process --output-on-failure \
--output-junit $TESTREPDIR/suites/ctest_report.xml \
-L '${{inputs.test_label_regexp}}' | \
sed -e 's/\x1b\[[0-9;]*m//g' | \
tee >(gzip --stdout > $WORKDIR/artifacts/${{steps.init.outputs.logfilename}}) | \
grep -E '(Test\s*#.*\*\*\*|\[FAIL\])|.*tests passed,.*tests failed out of' | \
tee $WORKDIR/short.log
- name: Test history upload results
if: always() && inputs.testman_token
shell: bash
run: |
testmo automation:run:submit-thread \
--instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}} \
--results $TESTREPDIR/unittests/*.xml
testmo automation:run:submit-thread \
--instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}} \
--results $TESTREPDIR/suites/*.xml \
-- cat $WORKDIR/short.log
testmo automation:run:complete --instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}}
- 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
|