ICU-23264 Add validateAndGet function to MeasureUnit for efficient unit validation #2095
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (C) 2016 and later: Unicode, Inc. and others. | |
| # License & terms of use: http://www.unicode.org/copyright.html | |
| # | |
| # GitHub Action configuration script for ICU continuous integration tasks. | |
| name: GHA ICU4J | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'maint/maint*' | |
| paths: | |
| - 'icu4j/**' | |
| - 'testdata/**' | |
| - '.github/workflows/**' | |
| pull_request: | |
| branches: '**' | |
| paths: | |
| - 'icu4j/**' | |
| - 'testdata/**' | |
| - '.github/workflows/**' | |
| workflow_dispatch: | |
| # To trigger the Env Test workflow manually, follow the instructions in | |
| # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow | |
| # For non-release branches (namely: PRs), only run CI on the most recent commit. Cancel | |
| # runs on previous commits mid-flight when new commits are pushed. | |
| # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-on-specific-branches | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ !contains(github.ref, 'maint/') && github.ref != 'main' }} | |
| env: | |
| SHARED_MVN_ARGS: '--show-version --no-transfer-progress' | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Initialize the Maven artifact cache | |
| # | |
| # This job is created according to the cache strategy of reuse from a single job: | |
| # https://github.com/actions/cache/blob/main/caching-strategies.md#make-cache-read-only--reuse-cache-from-centralized-job | |
| icu4j-mvn-init-cache: | |
| runs-on: ubuntu-22.04 # Updated in BRS | |
| steps: | |
| - name: Checkout and setup | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Cache local Maven repository | |
| uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| - uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '11' | |
| # Download all of the artifacts needed for the code and build plugins, but | |
| # exclude any needed by profiles depending on system artifacts | |
| - name: Download all artifacts | |
| run: | | |
| cd icu4j; | |
| mvn ${SHARED_MVN_ARGS} dependency:go-offline -P '!old_jdk_taglet' | |
| # Using the Java style formatter google-java-style provided by the Spotless | |
| # plugin configured in the root pom.xml using 4-space indents (AOSP style). | |
| # Spotless is configured to run only on files in this branch (PR) that differ | |
| # from origin/main | |
| formatter: | |
| name: Format checker | |
| needs: icu4j-mvn-init-cache | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout and setup | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 # fetch all branches so that Spotless can resolve `origin/main` | |
| - name: Restore read-only cache of local Maven repository | |
| uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| id: cache | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| lookup-only: true | |
| - uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Check Java style | |
| run: | | |
| cd icu4j; | |
| mvn spotless:check || (echo "Style checker failed. Formatting changes can be applied by 'mvn spotless:apply'" && exit 1) | |
| # Runs an error-prone test that fails the build if any issues are found. | |
| linter: | |
| name: Linter | |
| needs: icu4j-mvn-init-cache | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout and setup | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Restore read-only cache of local Maven repository | |
| uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| id: cache | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| lookup-only: true | |
| - uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Run error-prone | |
| run: | | |
| mvn -version | |
| # ICU_STATUS will be used to indicate whether the errorprone process succeeds or fails. | |
| # Failure means errors need to be fixed. | |
| echo "ICU_STATUS=1" >> "$GITHUB_ENV" | |
| mvn ${SHARED_MVN_ARGS} clean test -DskipTests -DskipITs -P errorprone -l /tmp/errorprone.log | |
| # We only get here if Maven does not fail | |
| echo "ICU_STATUS=0" >> "$GITHUB_ENV" | |
| continue-on-error: true | |
| - name: Generate errorprone report and output it to summary | |
| run: | | |
| if [ $ICU_STATUS -ne 0 ]; then | |
| grep '^\[ERROR\] ' /tmp/errorprone.log | |
| # We need to build this sub-project. If maven fails in a previous sub-project the | |
| # whole build stops and we never get to build the report tool, so we can't run it. | |
| mvn install -f icu4j/tools/build/ -q | |
| mvn exec:java -f icu4j/tools/build/ -P errorprone_report -DlogFile=/tmp/errorprone.log | |
| # Output messages and the error-prone report as workflow job summary | |
| echo '**Run this command locally and fix all errors:**' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo '`mvn clean test -DskipTests -DskipITs -P errorprone`' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo '**Error-prone errors:**' >> $GITHUB_STEP_SUMMARY | |
| grep -v -E ' WARNING | ICU_PRI' ./icu4j/target/errorprone.md >> $GITHUB_STEP_SUMMARY | |
| # User friendly messages to standard output | |
| echo 'View the Summary page of this Workflow instance to view the rendered Markdown of this report.' | |
| echo 'Run this command locally and fix all errors:' | |
| echo ' mvn clean test -DskipTests -DskipITs -P errorprone' | |
| exit 1 | |
| fi | |
| # ICU4J build and unit test using Maven | |
| # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
| icu4j-mvn-build-and-test: | |
| needs: icu4j-mvn-init-cache | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java-version: [ '11', '17', '21', '25' ] | |
| runs-on: ubuntu-22.04 # Updated in BRS | |
| steps: | |
| - name: Checkout and setup | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Restore read-only cache of local Maven repository | |
| uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| id: cache | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: ${{ matrix.java-version }} | |
| - name: ICU4J | |
| run: | | |
| cd icu4j; | |
| mvn ${SHARED_MVN_ARGS} verify | |
| - name: List failures (if any) | |
| run: | | |
| cd icu4j && cat `find . -name surefire-reports -type d -exec grep -l -r --include="*.txt" FAILED {} \;`; | |
| if: ${{ failure() }} | |
| # ICU4J build and unit test under lstm | |
| lstm-icu4j-build-and-test: | |
| if: false # TODO(ICU-22505) | |
| needs: icu4j-mvn-init-cache | |
| runs-on: ubuntu-22.04 # Updated in BRS | |
| steps: | |
| - name: Checkout and setup | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Restore read-only cache of local Maven repository | |
| uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| id: cache | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| lookup-only: true | |
| - uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '11' | |
| - name: Config LSTM and Rebuild data jar | |
| run: | | |
| cd icu4c/source; | |
| ICU_DATA_BUILDTOOL_OPTS=--include_uni_core_data ICU_DATA_FILTER_FILE=../../.github/lstm_for_th_my.json ./runConfigureICU --enable-debug --disable-release Linux -disable-layoutex; | |
| make clean; | |
| make -j -l4.5 ICU4J_ROOT=../../../icu4j icu4j-data-install; | |
| cd ../.. | |
| - name: ICU4J | |
| run: | | |
| cd icu4j; | |
| mvn ${SHARED_MVN_ARGS} verify | |
| - name: List failures (if any) | |
| run: | | |
| cd icu4j && cat `find . -name surefire-reports -type d -exec grep -l -r --include="*.txt" FAILED {} \;`; | |
| if: ${{ failure() }} | |
| # ICU4J build and unit test under adaboost | |
| adaboost-icu4j-build-and-test: | |
| if: false # Temporary disable, until we disable the .jar creation from C and distribute the individual files | |
| needs: icu4j-mvn-init-cache | |
| runs-on: ubuntu-22.04 # Updated in BRS | |
| steps: | |
| - name: Checkout and setup | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Restore read-only cache of local Maven repository | |
| uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| id: cache | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| lookup-only: true | |
| - uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '11' | |
| - name: Config Adaboost and Rebuild data jar | |
| run: | | |
| cd icu4c/source; | |
| ICU_DATA_BUILDTOOL_OPTS=--include_uni_core_data ICU_DATA_FILTER_FILE=../../.github/adaboost.json CPPFLAGS=-DUCONFIG_USE_ML_PHRASE_BREAKING=1 ./runConfigureICU --enable-debug --disable-release Linux -disable-layoutex; | |
| make clean; | |
| make -j -l4.5 ICU4J_ROOT=../../../icu4j icu4j-data-install; | |
| cd ../.. | |
| - name: ICU4J | |
| run: | | |
| cd icu4j; | |
| mvn ${SHARED_MVN_ARGS} -Dcom.ibm.icu.impl.breakiter.useMLPhraseBreaking=true verify | |
| - name: List failures (if any) | |
| run: | | |
| cd icu4j && cat `find . -name surefire-reports -type d -exec grep -l -r --include="*.txt" FAILED {} \;`; | |
| if: ${{ failure() }} | |