Skip to content

Commit 98eed0b

Browse files
Retry on fail for main test
1 parent db78480 commit 98eed0b

File tree

1 file changed

+46
-36
lines changed

1 file changed

+46
-36
lines changed

.github/workflows/test.yml

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -47,42 +47,52 @@ jobs:
4747
sudo npm install -g asar # to get pacakges.json from resources/app.asar for electron-builder applications
4848
# npm install -g @alexlafroscia/yaml-merge # to merge yaml files
4949
- name: Main test
50-
# shell: bash
51-
run: |
52-
# set -e
53-
mkdir $HOME/.icewm/
54-
echo "ShowTaskBar = 0" > $HOME/.icewm/preferences
55-
echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences
56-
echo "TaskBarShowWorkspaces = 0" > $HOME/.icewm/preferences
57-
echo "TaskBarShowAllWindows = 0" > $HOME/.icewm/preferences
58-
echo "TaskBarShowClock = 0" > $HOME/.icewm/preferences
59-
echo "TaskBarShowMailboxStatus = 0" > $HOME/.icewm/preferences
60-
echo "TaskBarShowCPUStatus = 0" > $HOME/.icewm/preferences
61-
echo "TaskBarShowWindowListMenu = 0" > $HOME/.icewm/preferences
62-
# xpra start :99 # Cannot get screenshots to work
63-
Xvfb :99 -screen 0 800x600x24 >/dev/null 2>&1 & # Need to set bit depth, otherwise get some black screenshots
64-
# until xset -q; do echo "Waiting for X server to start..."; sleep 1; done # We are not immediately using it anyway
65-
# Find out which files in data/ have been changed in the last commit
66-
#set -x # Debug #379
67-
FILES=$(git log -1 -p data/ | grep +++ | cut -d '/' -f 2-| sed -e 's|dev/null||g')
68-
# Finds wrong files in PRs! # FILES=$(git log -1 --name-status --diff-filter=AR --pretty=format: -- data/ | awk '/^A/ || /^R/ {file=$2} END {print file}') # Most recent addition or renaming within the last commit
69-
echo "Last changed files from the FILES variable:"
70-
echo "$FILES" ; if [ -z "$FILES" ] ; then echo "Variable FILES is empty." && exit 1 ; fi
71-
# Work on these files that have been changed in the last commit
72-
if [ -n "$FILES" ]; then
73-
for FILE in $FILES; do
74-
echo "$FILE"
75-
bash -e code/worker.sh $(readlink -f "$FILE") 2>&1 | tee log.txt
76-
EXIT_CODE=${PIPESTATUS[0]} # bashism; get the return code of the leftmost element of the pipe
77-
if [ $EXIT_CODE -ne 0 ]; then
78-
echo "worker.sh exited with a non-zero code: $EXIT_CODE"
79-
exit $EXIT_CODE
80-
fi
81-
done
82-
fi
83-
# xpra stop :99
84-
killall Xvfb
85-
# bundle exec jekyll build # https://help.github.com/en/articles/viewing-jekyll-build-error-messages#configuring-a-third-party-service-to-display-jekyll-build-error-messages
50+
uses: nick-fields/retry@v3
51+
with:
52+
max_attempts: 5
53+
timeout_minutes: 5
54+
retry_wait_seconds: 60
55+
warning_on_retry: true
56+
on_retry_command: |
57+
if [ -f log.txt ]; then
58+
echo "Previous log from worker.sh:"
59+
cat log.txt
60+
fi
61+
command: |
62+
# set -e
63+
mkdir $HOME/.icewm/
64+
echo "ShowTaskBar = 0" > $HOME/.icewm/preferences
65+
echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences
66+
echo "TaskBarShowWorkspaces = 0" > $HOME/.icewm/preferences
67+
echo "TaskBarShowAllWindows = 0" > $HOME/.icewm/preferences
68+
echo "TaskBarShowClock = 0" > $HOME/.icewm/preferences
69+
echo "TaskBarShowMailboxStatus = 0" > $HOME/.icewm/preferences
70+
echo "TaskBarShowCPUStatus = 0" > $HOME/.icewm/preferences
71+
echo "TaskBarShowWindowListMenu = 0" > $HOME/.icewm/preferences
72+
# xpra start :99 # Cannot get screenshots to work
73+
Xvfb :99 -screen 0 800x600x24 >/dev/null 2>&1 & # Need to set bit depth, otherwise get some black screenshots
74+
# until xset -q; do echo "Waiting for X server to start..."; sleep 1; done # We are not immediately using it anyway
75+
# Find out which files in data/ have been changed in the last commit
76+
#set -x # Debug #379
77+
FILES=$(git log -1 -p data/ | grep +++ | cut -d '/' -f 2-| sed -e 's|dev/null||g')
78+
# Finds wrong files in PRs! # FILES=$(git log -1 --name-status --diff-filter=AR --pretty=format: -- data/ | awk '/^A/ || /^R/ {file=$2} END {print file}') # Most recent addition or renaming within the last commit
79+
echo "Last changed files from the FILES variable:"
80+
echo "$FILES" ; if [ -z "$FILES" ] ; then echo "Variable FILES is empty." && exit 1 ; fi
81+
# Work on these files that have been changed in the last commit
82+
if [ -n "$FILES" ]; then
83+
for FILE in $FILES; do
84+
echo "$FILE"
85+
bash -e code/worker.sh $(readlink -f "$FILE") 2>&1 | tee log.txt
86+
EXIT_CODE=${PIPESTATUS[0]} # bashism; get the return code of the leftmost element of the pipe
87+
if [ $EXIT_CODE -ne 0 ]; then
88+
echo "worker.sh exited with a non-zero code: $EXIT_CODE"
89+
exit $EXIT_CODE
90+
fi
91+
done
92+
fi
93+
# xpra stop :99
94+
killall Xvfb
95+
# bundle exec jekyll build # https://help.github.com/en/articles/viewing-jekyll-build-error-messages#configuring-a-third-party-service-to-display-jekyll-build-error-messages
8696
- name: Check log
8797
if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'probonopd'
8898
shell: bash

0 commit comments

Comments
 (0)