Skip to content

Commit 75e9988

Browse files
committed
ci: add flaky test catching workflow
Add new ci workflow running all files changed in the PR commits multiple times in parallel by default. Can be disabled by setting the noflaky PR label. Co-authored-by: Nikita Zheleztsov <n.zheleztsov@proton.me> Fixes #531 NO_DOC=ci NO_TEST=ci
1 parent 6fb7b58 commit 75e9988

File tree

3 files changed

+99
-1
lines changed

3 files changed

+99
-1
lines changed

.github/workflows/catch_flaky.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: catch_flaky
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'test/*/*_test.lua'
7+
- 'test/*/*.test.lua'
8+
9+
jobs:
10+
catch_flaky:
11+
if: github.event_name == 'pull_request' &&
12+
!contains(github.event.pull_request.labels.*.name, 'noflaky')
13+
14+
env:
15+
TNT_RELEASE_PATH: /home/runner/tnt-release
16+
17+
runs-on: ubuntu-22.04
18+
timeout-minutes: 180
19+
steps:
20+
- name: Create variables for Tarantool
21+
run: |
22+
branch=master
23+
commit_hash=$(git ls-remote \
24+
https://github.com/tarantool/tarantool.git \
25+
--branch ${branch} | head -c 8)
26+
echo "TNT_BRANCH=${branch}" >> $GITHUB_ENV
27+
echo "VERSION_POSTFIX=-${commit_hash}" >> $GITHUB_ENV
28+
shell: bash
29+
30+
- name: Cache tarantool build
31+
id: cache-tnt-release
32+
uses: actions/cache@v3
33+
with:
34+
path: ${{ env.TNT_RELEASE_PATH }}
35+
key: cache-tnt-release-master${{ env.VERSION_POSTFIX }}
36+
37+
- name: Clone tarantool
38+
if: steps.cache-tnt-release.outputs.cache-hit != 'true'
39+
uses: actions/checkout@v3
40+
with:
41+
repository: tarantool/tarantool
42+
ref: ${{ env.TNT_BRANCH }}
43+
path: tarantool
44+
fetch-depth: 0
45+
submodules: true
46+
47+
- name: Build tarantool
48+
if: steps.cache-tnt-release.outputs.cache-hit != 'true'
49+
run: |
50+
sudo apt-get -y install build-essential cmake make zlib1g-dev \
51+
libreadline-dev libncurses5-dev libssl-dev libunwind-dev \
52+
libicu-dev python3 python3-yaml python3-six python3-gevent
53+
cd ${GITHUB_WORKSPACE}/tarantool
54+
mkdir build && cd build
55+
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_DIST=ON
56+
make && make DESTDIR=${TNT_RELEASE_PATH} install
57+
58+
- name: Install tarantool
59+
# Workaround as actions/cache cannot restore data to /usr/local
60+
run: sudo cp -rvP ${TNT_RELEASE_PATH}/usr/local/* /usr/local/
61+
62+
- name: Clone the module
63+
uses: actions/checkout@v3
64+
with:
65+
# Fetch the entire history for all branches and tags. It is needed for
66+
# upgrade testing.
67+
fetch-depth: 0
68+
# Enable recursive submodules checkout as test-run git module is used
69+
# for running tests.
70+
submodules: recursive
71+
ref: ${{ github.event.pull_request.head.sha }}
72+
73+
- name: Install test requirements
74+
run: pip3 install --user -r test-run/requirements.txt
75+
76+
- name: Setup tt
77+
run: |
78+
curl -L https://tarantool.io/release/2/installer.sh | sudo bash
79+
sudo apt install -y tt
80+
tt version
81+
82+
- name: Setup luatest
83+
run: tt rocks install luatest
84+
85+
- run: cmake .
86+
- run: make test-flaky
87+
env:
88+
RANGE: HEAD~${{ github.event.pull_request.commits }}..HEAD

.github/workflows/fast_testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
tt version
108108
109109
- name: Setup luatest
110-
run: tt rocks install luatest 1.2.1
110+
run: tt rocks install luatest
111111

112112
- run: cmake .
113113
- run: make test-force

test/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,13 @@ add_custom_target(test-force
88
--builddir=${PROJECT_BINARY_DIR}
99
--vardir=${PROJECT_BINARY_DIR}/test/var
1010
--force)
11+
12+
add_custom_target(test-flaky
13+
COMMAND git diff --relative=test/ --name-only
14+
$$\{RANGE:-master..HEAD\}
15+
-- "./*/*test.lua" |
16+
xargs -L 128 -r ${PROJECT_SOURCE_DIR}/test/test-run.py
17+
--force --retries=0
18+
--repeat=$$\{N_TRIALS:-32\}
19+
--builddir=${PROJECT_BINARY_DIR}
20+
--vardir=${PROJECT_BINARY_DIR}/test/var)

0 commit comments

Comments
 (0)