Skip to content

Commit

Permalink
Make exhaustive tests run manually, update doc and fix clanf-datafilt…
Browse files Browse the repository at this point in the history
…er job
  • Loading branch information
rp9-next committed Aug 30, 2024
1 parent 73ef262 commit 110bdc6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 116 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/icu4c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Extract ICU version
run: |
# Extract ICU version from icuver.txt
icuverContent=$(cat icu4c/source/data/misc/icuver.txt)
icuVersion=$(echo "$icuverContent" | grep -oP 'ICUVersion\{"\K\d+\.\d+\.\d+\.\d+')
majorVersion=$(echo "$icuVersion" | cut -d. -f1)
echo "majorVersion=$majorVersion"
echo "majorVersion=$majorVersion" >> $GITHUB_ENV
- name: Build ICU4C with clang
run: |
cd icu4c/source && \
ICU_DATA_FILTER_FILE=../../.github/data-filter.json ./runConfigureICU Linux/clang && \
make -j2 tests && \
\[ ! -d data/out/build/icudt66l/translit \] && \
\[ ! -d data/out/build/icudt${majorVersion}l/translit \] && \
(cd test/intltest && LD_LIBRARY_PATH=../../lib:../../tools/ctestfw ./intltest translit/TransliteratorTest/TestBasicTransliteratorEvenWithoutData) && \
(cd test/cintltst && LANG=C LD_LIBRARY_PATH=../../lib:../../tools/ctestfw ./cintltst /tsutil/cloctst/TestEnglishExemplarCharacters /tsutil/cldrtest/TestCoverage)
Expand Down
115 changes: 3 additions & 112 deletions .github/workflows/icu_exhaustive_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,21 @@
# Note: The exhaustive test configuration is in a separate file
# so that it can be run independently from the regular builds.
#
# To run these tests, comment on a PR with "run exhaustive tests"
# or manually trigger the workflow. If triggered from a PR comment,
# it adds checks to the PR and updates them with the results.
# To run these tests, go to the Actions Tab on the github page,
# select "Exhaustive Tests for ICU" and manually trigger the workflow for your branch.

name: Exhaustive Tests for ICU

env:
PR_COMMENT_TRIGGER_TEXT: "run exhaustive tests"

on:
workflow_dispatch:
issue_comment:
types: [created]

permissions:
checks: write
pull-requests: write

jobs:

# Runs exhaustive tests for ICU4J on Linux
icu4j-linux:
if: github.event.issue.pull_request != null &&
(contains(github.event_name, 'workflow_dispatch') ||
contains(github.event.comment.body, ${{ env.PR_COMMENT_TRIGGER_TEXT }}))
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Fetch PR Details
id: pr-details
if: contains(github.event.comment.body, ${{ env.PR_COMMENT_TRIGGER_TEXT }})
run: |
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
gh api "${{ github.event.issue.pull_request.url }}" > pr.json
PR_NUMBER=$(jq -r '.number' pr.json)
SHA=$(jq -r '.head.sha' pr.json)
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
echo "SHA=$SHA" >> $GITHUB_ENV
- name: Add a check to the PR
id: add-check
if: contains(github.event.comment.body, ${{ env.PR_COMMENT_TRIGGER_TEXT }})
run: |
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo $WORKFLOW_URL
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
CHECK_ID=$(gh api \
-X POST \
-F name='Exhaustive Tests / ICU4J' \
-F head_sha="${{ env.SHA }}" \
-F status='in_progress' \
-F details_url=$WORKFLOW_URL \
-F output[title]='Exhaustive Tests' \
-F output[summary]='Running exhaustive tests for ICU4J' \
-F output[text]=$WORKFLOW_URL \
/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/check-runs \
-q .id)
echo "CHECK_ID=$CHECK_ID" >> $GITHUB_ENV
- name: Build and Exhaustive Tests
run: |
echo "Building ICU4J" && cd icu4j && mvn install -DICU.exhaustive=10
Expand All @@ -74,61 +31,13 @@ jobs:
run: |
cd icu4j && cat `find . -name surefire-reports -type d -exec grep -l -r --include="*.txt" FAILED {} \;`
timeout-minutes: 2
- name: Complete the check
if: always() && contains(github.event.comment.body, ${{ env.PR_COMMENT_TRIGGER_TEXT }})
run: |
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
STATUS="completed"
CONCLUSION="success"
if [ "${{ job.status }}" != "success" ]; then
CONCLUSION="failure"
fi
gh api \
-X PATCH \
-F status="$STATUS" \
-F conclusion="$CONCLUSION" \
-F details_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
-F output[title]='Exhaustive Tests' \
-F output[summary]='Completed exhaustive tests for ICU4J' \
-F output[text]=$WORKFLOW_URL \
/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/check-runs/${{ env.CHECK_ID }}


icu4c-linux-clang:
if: contains(github.event_name, 'workflow_dispatch') || contains(github.event.comment.body, 'run exhaustive tests')
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Fetch PR Details
id: pr-details
if: contains(github.event.comment.body, 'run exhaustive tests')
run: |
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
gh api "${{ github.event.issue.pull_request.url }}" > pr.json
PR_NUMBER=$(jq -r '.number' pr.json)
SHA=$(jq -r '.head.sha' pr.json)
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
echo "SHA=$SHA" >> $GITHUB_ENV
- name: Add a check to the PR
id: add-check
if: contains(github.event.comment.body, ${{ env.PR_COMMENT_TRIGGER_TEXT }})
run: |
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo $WORKFLOW_URL
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
CHECK_ID=$(gh api \
-X POST \
-F name='Exhaustive Tests / ICU4C' \
-F head_sha="${{ env.SHA }}" \
-F status='in_progress' \
-F details_url=$WORKFLOW_URL \
-F output[title]='Exhaustive Tests' \
-F output[summary]='Running exhaustive tests for ICU4C' \
-F output[text]=$WORKFLOW_URL \
/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/check-runs \
-q .id)
echo "CHECK_ID=$CHECK_ID" >> $GITHUB_ENV
- name: Build
run: |
cd icu4c/source && ./runConfigureICU Linux/clang && make -j -l4.5
Expand All @@ -137,22 +46,4 @@ jobs:
cd icu4c/source && make check-exhaustive
env:
CC: clang
CXX: clang++
- name: Complete the check
if: always() && contains(github.event.comment.body, ${{ env.PR_COMMENT_TRIGGER_TEXT }})
run: |
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
STATUS="completed"
CONCLUSION="success"
if [ "${{ job.status }}" != "success" ]; then
CONCLUSION="failure"
fi
gh api \
-X PATCH \
-F status="$STATUS" \
-F conclusion="$CONCLUSION" \
-F details_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
-F output[title]='Exhaustive Tests' \
-F output[summary]='Completed exhaustive tests for ICU4C' \
-F output[text]=$WORKFLOW_URL \
/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/check-runs/${{ env.CHECK_ID }}
CXX: clang++
Binary file added docs/userguide/assets/gha_run_workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/userguide/assets/gha_tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions docs/userguide/dev/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ They must pass before new versions of CLDR can be integrated into ICU,
which is a part of the release process.

It may be desirable to run exhaustive tests manually on a PR for areas of code that are known to need the extra test coverage provided by exhaustive tests.
To trigger exhaustive tests manually:

Exhaustive tests can be triggered manually on a PR by adding a comment containing the following text.

`run exhaustive tests`
1. Go to your respective fork of the project (username/icu) if the PR is not already merged. Otherwise, go to https://github.com/unicode-org/icu
2. Select on the "Actions" tab from the top bar
![GHA Actions](../assets/gha_tab.png)
3. On the left pane under All workflows, find "Exhaustive Tests for ICU" and click on run workflow, select branch and click 'Run workflow'.
![Run Workflow](../assets/gha_run_workflow.png)

0 comments on commit 110bdc6

Please sign in to comment.