Skip to content

Commit 39f9b88

Browse files
committed
Find existing issues and skip steps
1 parent 6999e91 commit 39f9b88

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

.github/workflows/check-new-library-versions-in-batch.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ jobs:
6060
env:
6161
CURRENT_JOB_NAME: "🧪 ${{ matrix.item.name }}"
6262
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
ISSUE_TITLE_PREFIX: "[Automation] Testing failed for library: "
64-
ISSUE_BODY_PREFIX: "Failure kind: "
63+
ISSUE_TITLE_PREFIX: "[Automation] "
64+
ISSUE_TITLE_MIDDLE: " fails for "
6565
LOG_LINES: "300"
6666
strategy:
6767
fail-fast: false
@@ -86,7 +86,7 @@ jobs:
8686
github-token: ${{ secrets.GITHUB_TOKEN }}
8787
native-image-job-reports: 'true'
8888

89-
- name: "Check for existing failure issue and skip if found"
89+
- name: "Check for an existing issue and skip further testing if found"
9090
id: check_existing_issue
9191
run: |
9292
GROUP_ID="$(echo "${{ matrix.item.name }}" | cut -d: -f1)"
@@ -95,17 +95,20 @@ jobs:
9595
readarray -t VERSIONS < <(echo '${{ toJson(matrix.item.versions) }}' | jq -r '.[]')
9696
FIRST_TESTING_VERSION="${VERSIONS[0]}"
9797
98-
TITLE="${{ env.ISSUE_TITLE_PREFIX }}$GROUP_ID:$ARTIFACT_ID:$FIRST_TESTING_VERSION"
98+
TITLE_SEARCH="${{ env.ISSUE_TITLE_MIDDLE }}$GROUP_ID:$ARTIFACT_ID:$FIRST_TESTING_VERSION failed in"
9999
100-
ISSUE_NUMBER=$(gh issue list --repo "${{ github.repository }}" --state open --search "$TITLE" --json number,title,body --jq \
101-
'.[] | select(.title == "'"$TITLE"'") | .number')
100+
ISSUE_NUMBER=$(gh issue list --repo "${{ github.repository }}" --state open --search "in:title $TITLE_SEARCH" --json number,title --jq \
101+
'.[] | select(.title | endswith("'"$TITLE_SEARCH"'")) | .number')
102102
103103
if [[ -n "$ISSUE_NUMBER" ]]; then
104+
echo "skip=true" >> "$GITHUB_OUTPUT"
104105
echo "There is no progress since last time this version was tested. Skipping further steps."
105-
exit 0
106+
else
107+
echo "skip=false" >> "$GITHUB_OUTPUT"
106108
fi
107109
108110
- name: "Extract test path and library version"
111+
if: steps.check_existing_issue.outputs.skip != 'true'
109112
id: extract-params
110113
run: |
111114
LIBRARY_PATH=$(echo "${{ matrix.item.name }}" | sed 's/:/\//g')
@@ -118,12 +121,15 @@ jobs:
118121
echo "TEST_COORDINATES=$TEST_COORDINATES" >> ${GITHUB_ENV}
119122
120123
- name: "Pull allowed docker images"
124+
if: steps.check_existing_issue.outputs.skip != 'true'
121125
run: ./gradlew pullAllowedDockerImages --coordinates="${{ env.TEST_COORDINATES }}"
122126

123127
- name: "Disable docker networking"
128+
if: steps.check_existing_issue.outputs.skip != 'true'
124129
run: bash ./.github/workflows/disable-docker.sh
125130

126131
- name: "🧪 Run '${{ env.TEST_COORDINATES }}' tests"
132+
if: steps.check_existing_issue.outputs.skip != 'true'
127133
id: runtests
128134
run: |
129135
bash ./.github/workflows/run-consecutive-tests.sh "${{ env.TEST_COORDINATES }}" '${{ toJson(matrix.item.versions) }}' 2>&1 | tee test_results.txt || true
@@ -157,7 +163,7 @@ jobs:
157163
echo "EOF" >> $GITHUB_OUTPUT
158164
159165
- name: "✔️ New library versions are supported (with locks, waiting and retries)"
160-
if: steps.runtests.outputs.successful_versions != ''
166+
if: steps.check_existing_issue.outputs.skip != 'true' && steps.runtests.outputs.successful_versions != ''
161167
env:
162168
BRANCH: ${{ needs.get-all-libraries.outputs.branch }}
163169
run: |
@@ -205,27 +211,27 @@ jobs:
205211
exit 1
206212
207213
- name: "❗ New library version is not supported"
208-
if: steps.runtests.outputs.failed_version != ''
214+
if: steps.check_existing_issue.outputs.skip != 'true' && steps.runtests.outputs.failed_version != ''
209215
run: |
210216
git config --local user.email "[email protected]"
211217
git config --local user.name "Github Actions"
212218
213219
FAILED_VERSION="${{ steps.runtests.outputs.failed_version }}"
214220
REPO="${{ github.repository }}"
215-
TITLE="${{ env.ISSUE_TITLE_PREFIX }}${{ matrix.item.name }}:$FAILED_VERSION"
221+
TITLE="${{ env.ISSUE_TITLE_PREFIX }}${{ steps.runtests.outputs.failure_type }}${{ env.ISSUE_TITLE_MIDDLE }}${{ matrix.item.name }}:$FAILED_VERSION"
216222
217223
BODY_FILE=$(mktemp)
218224
# Use single-quoted here-doc to disable any shell expansion of log content
219225
cat > "$BODY_FILE" <<'EOF'
220-
${{ env.ISSUE_BODY_PREFIX }}${{ steps.runtests.outputs.failure_type }}
226+
Failure kind: ${{ steps.runtests.outputs.failure_type }}
221227
Runner log: ${{ steps.runtests.outputs.runner_log_url }}
222228
Last ${{ env.LOG_LINES }} lines of the log:
223229
```console
224230
${{ steps.runtests.outputs.log_tail }}
225231
```
226232
EOF
227233
228-
ISSUE_NUMBER=$(gh issue list --repo "$REPO" --state open --search "$TITLE" --json number,title --jq '.[] | select(.title == "'"$TITLE"'") | .number')
234+
ISSUE_NUMBER=$(gh issue list --repo "$REPO" --state open --search "$TITLE" --json number,title --jq '.[] | select(.title | startswith("'"$TITLE"'")) | .number')
229235
if [ -n "$ISSUE_NUMBER" ]; then
230236
echo "Updating existing issue #$ISSUE_NUMBER"
231237
gh issue edit "$ISSUE_NUMBER" --repo "$REPO" --body-file "$BODY_FILE"

.github/workflows/run-consecutive-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ for VERSION in "${VERSIONS[@]}"; do
2929
GVM_TCK_LV="$VERSION" ./gradlew clean javac -Pcoordinates="$TEST_COORDINATES"
3030
RESULT=$?
3131
if [ "$RESULT" -ne 0 ]; then
32-
echo "FAILED [javac]:$VERSION"
32+
echo "FAILED ['javac' Compile]:$VERSION"
3333
break
3434
fi
3535

@@ -49,7 +49,7 @@ for VERSION in "${VERSIONS[@]}"; do
4949
if [ "$RESULT" -eq 0 ]; then
5050
echo "PASSED:$VERSION"
5151
else
52-
echo "FAILED [native-test]:$VERSION"
52+
echo "FAILED ['native-image' Test Run]:$VERSION"
5353
break
5454
fi
5555
done

0 commit comments

Comments
 (0)