|
88 | 88 | # change anything, which makes little sense; but that is the job of the |
89 | 89 | # other job. |
90 | 90 | - name: Run invariant tests |
91 | | - run: MAVEN_OPTS="-ea" mvn -s .github/workflows/mvn-settings.xml test -am -pl unicodetools -Dtest=TestTestUnicodeInvariants -DfailIfNoTests=false -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=$CURRENT_UVERSION |
| 91 | + run: MAVEN_OPTS="-ea" mvn -s .github/workflows/mvn-settings.xml test -am -pl unicodetools -Dtest=TestTestUnicodeInvariants#testUnicodeInvariants -DfailIfNoTests=false -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=$CURRENT_UVERSION |
92 | 92 | env: |
93 | 93 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
94 | 94 |
|
@@ -170,7 +170,7 @@ jobs: |
170 | 170 | - name: Run command - Build and Test |
171 | 171 | run: | |
172 | 172 | cd unicodetools/mine/src |
173 | | - MAVEN_OPTS="-ea" mvn -s .github/workflows/mvn-settings.xml package -DCLDR_DIR=$(cd ../../../cldr/mine/src ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd ../Generated ; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=$CURRENT_UVERSION |
| 173 | + MAVEN_OPTS="-ea" mvn -s .github/workflows/mvn-settings.xml package -Dtest=!TestTestUnicodeInvariants#testSecurityInvariants -DCLDR_DIR=$(cd ../../../cldr/mine/src ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd ../Generated ; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=$CURRENT_UVERSION -DEMIT_GITHUB_ERRORS |
174 | 174 | env: |
175 | 175 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
176 | 176 |
|
@@ -275,6 +275,22 @@ jobs: |
275 | 275 | with: |
276 | 276 | repository: unicode-org/unicodetools |
277 | 277 | path: unicodetools/mine/src |
| 278 | + - name: Checkout base UnicodeData.txt |
| 279 | + if: ${{ github.event_name == 'pull_request'}} |
| 280 | + uses: actions/checkout@v3 |
| 281 | + with: |
| 282 | + ref: ${{ github.event.pull_request.base.sha }} |
| 283 | + path: base |
| 284 | + sparse-checkout: unicodetools/data/ucd/dev/UnicodeData.txt |
| 285 | + - name: Compare repertoire |
| 286 | + if: ${{ github.event_name == 'pull_request'}} |
| 287 | + run: | |
| 288 | + # Look for changes affecting the first two fields of UnicodeData.txt (code point and name). |
| 289 | + sed 's/^\([^;]*;[^;]*\);.*$/\1/' unicodetools/mine/src/unicodetools/data/ucd/dev/UnicodeData.txt > merged-repertoire.txt |
| 290 | + sed 's/^\([^;]*;[^;]*\);.*$/\1/' base/unicodetools/data/ucd/dev/UnicodeData.txt > base-repertoire.txt |
| 291 | + set +e |
| 292 | + diff base-repertoire.txt merged-repertoire.txt |
| 293 | + echo "REPERTOIRE_CHANGED=$?" >> "$GITHUB_ENV" |
278 | 294 | - name: Get the CLDR_REF from pom.xml |
279 | 295 | id: cldr_ref |
280 | 296 | run: echo "CLDR_REF="$(mvn --file unicodetools/mine/src/pom.xml help:evaluate -Dexpression=cldr.version -q -DforceStdout | cut -d- -f3) >> $GITHUB_OUTPUT && cat ${GITHUB_OUTPUT} |
@@ -316,9 +332,92 @@ jobs: |
316 | 332 | - name: Run command - UCA - collation validity log |
317 | 333 | run: | |
318 | 334 | cd unicodetools/mine/src |
| 335 | + echo "REPERTOIRE_CHANGED=$REPERTOIRE_CHANGED" |
| 336 | + if [[ ${REPERTOIRE_CHANGED:-0} -ne 0 ]] |
| 337 | + then set +e |
| 338 | + fi |
319 | 339 | # invoke main() in class ...UCA.Main |
320 | 340 | mvn -s .github/workflows/mvn-settings.xml compile exec:java -Dexec.mainClass="org.unicode.text.UCA.Main" -Dexec.args="writeCollationValidityLog ICU" -am -pl unicodetools -DCLDR_DIR=$(cd ../../../cldr/mine/src ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd ../Generated ; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=$CURRENT_UVERSION |
321 | 341 | # check for output file |
322 | 342 | compgen -G "../Generated/UCA/*/CheckCollationValidity.html" |
323 | 343 | env: |
324 | 344 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 345 | + |
| 346 | + # Out-of-source build. |
| 347 | + security: |
| 348 | + name: Check security data invariants |
| 349 | + runs-on: ubuntu-latest |
| 350 | + steps: |
| 351 | + - name: Checkout Unicode Tools |
| 352 | + uses: actions/checkout@v3 |
| 353 | + with: |
| 354 | + repository: unicode-org/unicodetools |
| 355 | + path: unicodetools/mine/src |
| 356 | + - name: Checkout base UnicodeData.txt |
| 357 | + if: ${{ github.event_name == 'pull_request'}} |
| 358 | + uses: actions/checkout@v3 |
| 359 | + with: |
| 360 | + ref: ${{ github.event.pull_request.base.sha }} |
| 361 | + path: base |
| 362 | + sparse-checkout: unicodetools/data/ucd/dev/UnicodeData.txt |
| 363 | + - name: Compare repertoire |
| 364 | + if: ${{ github.event_name == 'pull_request'}} |
| 365 | + run: | |
| 366 | + # Look for changes affecting the first two fields of UnicodeData.txt (code point and name). |
| 367 | + sed 's/^\([^;]*;[^;]*\);.*$/\1/' unicodetools/mine/src/unicodetools/data/ucd/dev/UnicodeData.txt > merged-repertoire.txt |
| 368 | + sed 's/^\([^;]*;[^;]*\);.*$/\1/' base/unicodetools/data/ucd/dev/UnicodeData.txt > base-repertoire.txt |
| 369 | + set +e |
| 370 | + diff base-repertoire.txt merged-repertoire.txt |
| 371 | + echo "REPERTOIRE_CHANGED=$?" >> "$GITHUB_ENV" |
| 372 | + - name: Get the CLDR_REF from pom.xml |
| 373 | + id: cldr_ref |
| 374 | + run: echo "CLDR_REF="$(mvn --file unicodetools/mine/src/pom.xml help:evaluate -Dexpression=cldr.version -q -DforceStdout | cut -d- -f3) >> $GITHUB_OUTPUT && cat ${GITHUB_OUTPUT} |
| 375 | + - name: Verify CLDR checkout ref |
| 376 | + run: echo CLDR_REF="${{ steps.cldr_ref.outputs.CLDR_REF }}" && [ "${{ steps.cldr_ref.outputs.CLDR_REF }}x" != "x" ] # fail if empty |
| 377 | + - name: Cache CLDR repository |
| 378 | + uses: actions/cache@v3 |
| 379 | + with: |
| 380 | + path: cldr/mine/src |
| 381 | + key: cldr-${{ steps.cldr_ref.outputs.CLDR_REF }} |
| 382 | + restore-keys: | |
| 383 | + cldr |
| 384 | + - name: Check out CLDR |
| 385 | + uses: actions/checkout@v3 |
| 386 | + with: |
| 387 | + repository: unicode-org/cldr |
| 388 | + path: cldr/mine/src |
| 389 | + ref: main |
| 390 | + fetch-depth: 0 |
| 391 | + - name: Switch CLDR to CLDR_REF |
| 392 | + run: cd cldr/mine/src && git fetch && git checkout ${{ steps.cldr_ref.outputs.CLDR_REF }} |
| 393 | + - name: Set up JDK 11 |
| 394 | + uses: actions/setup-java@v1 |
| 395 | + with: |
| 396 | + java-version: 11 |
| 397 | + - name: Cache local Maven repository |
| 398 | + uses: actions/cache@v2 |
| 399 | + with: |
| 400 | + path: ~/.m2/repository |
| 401 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 402 | + restore-keys: | |
| 403 | + ${{ runner.os }}-maven- |
| 404 | + - name: Set up out-of-source output dir |
| 405 | + run: | |
| 406 | + mkdir -p unicodetools/mine/Generated/BIN |
| 407 | +
|
| 408 | + - name: Run invariant tests |
| 409 | + run: | |
| 410 | + cd unicodetools/mine/src |
| 411 | + echo "REPERTOIRE_CHANGED=$REPERTOIRE_CHANGED" |
| 412 | + if [[ ${REPERTOIRE_CHANGED:-0} -ne 0 ]] |
| 413 | + then ERROR="::notice" |
| 414 | + else ERROR="::error" |
| 415 | + fi |
| 416 | + MAVEN_OPTS="-ea" mvn -s .github/workflows/mvn-settings.xml test -am -pl unicodetools -Dtest=TestTestUnicodeInvariants#testSecurityInvariants -DCLDR_DIR=$(cd ../../../cldr/mine/src ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd ../Generated ; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=$CURRENT_UVERSION -DfailIfNoTests=false -DEMIT_GITHUB_ERRORS 2>&1 | sed "s/^::error/$ERROR/" |
| 417 | + STATUS=${PIPESTATUS[0]} |
| 418 | + if [[ ${REPERTOIRE_CHANGED:-0} -ne 0 ]] |
| 419 | + then exit 0 |
| 420 | + else exit $STATUS |
| 421 | + fi |
| 422 | + env: |
| 423 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments