From bfa39570becab8a2601c70a45b685bc94eba7be1 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 16 Sep 2021 13:58:24 -0500 Subject: [PATCH] CLDR-14989 GitHub Action to build ICU with CLDR (#1488) (#1501) (cherry picked from commit 62c90a357dc25911db60fcdf7d5a80119df27963) --- .github/workflows/build-icu.yml | 190 +++++++++++++++++++++++++++++++- 1 file changed, 186 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-icu.yml b/.github/workflows/build-icu.yml index d3595c9194c..459730c2f71 100644 --- a/.github/workflows/build-icu.yml +++ b/.github/workflows/build-icu.yml @@ -28,7 +28,7 @@ jobs: name: Build Production Data runs-on: ubuntu-latest steps: - - name: Clone Repository (Custom Ref) + - name: Clone CLDR uses: actions/checkout@v2 with: ref: ${{ github.event.inputs.cldr-ref }} @@ -59,14 +59,196 @@ jobs: - name: Build prod Data run: | rm -rf target/cldr-prod - mkdir -p target/cldr-prod + mkdir -p target/cldr-prod/common mvn -s .github/workflows/mvn-settings.xml -B -DCLDR_DIR=$(pwd) -DCLDR_GITHUB_ANNOTATIONS=true --file=tools/pom.xml -pl cldr-code \ exec:java -Dexec.mainClass=org.unicode.cldr.tool.GenerateProductionData \ - -Dexec.args="-d target/cldr-prod" + -Dexec.args="-d target/cldr-prod/common/" + (cd target/cldr-prod/ && zip -r ../cldr-prod.zip *) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload cldr-prod uses: actions/upload-artifact@v2 with: name: cldr-prod - path: target/cldr-prod + path: target/cldr-prod.zip + genicudata: + name: Generate ICU4C Data + runs-on: ubuntu-latest + needs: proddata + steps: + - name: Download CLDR Production Artifact + id: downloadprod + uses: actions/download-artifact@v2 + with: + name: cldr-prod + path: . + - name: Download CLDR tools + id: downloadtools + uses: actions/download-artifact@v2 + with: + name: cldr-code + path: cldr-code + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Setup Maven Settings + uses: s4u/maven-settings-action@v2.4.1 + with: + servers: | + [{ + "id": "github", + "username": "${{ github.actor }}", + "password": "${{ github.token }}" + },{ + "id": "githubicu", + "username": "${{ github.actor }}", + "password": "${{ github.token }}" + },{ + "id": "githubcldr", + "username": "${{ github.actor }}", + "password": "${{ github.token }}" + }] + - name: Create empty CLDR dir, unpack cldr-prod + run: mkdir -p cldr cldr-prod && cd cldr-prod && unzip ../cldr-prod.zip + # Don't actually need CLDR + # - name: Clone CLDR + # uses: actions/checkout@v2 + # with: + # ref: ${{ github.event.inputs.cldr-ref }} + # lfs: false + # repository: ${{ github.event.inputs.cldr-repo }} + # path: cldr + - name: Clone ICU + uses: actions/checkout@v2 + with: + repository: ${{ github.event.inputs.icu-repo }} + ref: ${{ github.event.inputs.icu-ref }} + lfs: false # not needed here + path: icu + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('icu/tools/**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Install CLDR tools + # TODO: Should not have to do this, see ICU-21425 + # Do this after restoring cache. + run: > + mvn -B install:install-file -Dproject.parent.relativePath="" -DgroupId=org.unicode.cldr + -DartifactId=cldr-api -Dversion=0.1-SNAPSHOT -Dpackaging=jar -DgeneratePom=true + -Dfile=cldr-code/cldr-code.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Generate ICU4C Data + run: > + env + TOOLS_ROOT=$(pwd)/icu/tools/ + CLDR_DIR=$(pwd)/cldr + CLDR_DATA_DIR=$(pwd)/cldr-prod/ + ant -f icu/tools/cldr/cldr-to-icu/build-icu-data.xml clean all && ln icu/icu4c/LICENSE icu/icu4c/source/data/ + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Zip up icu-data.zip + run: 'cd icu/icu4c/source && zip -rlq ../../../icu-data.zip data' + - name: Upload icu-data.zip + uses: actions/upload-artifact@v2 + with: + name: icu-data + path: icu-data.zip + # clang release build with some options to enforce useful constraints. + # Includes dependency checker on an in-source, optimized build. + # Includes checking @draft etc. API tags vs. ifndef guards like + # U_HIDE_DRAFT_API and U_FORCE_HIDE_DRAFT_API. + # (FORCE guards make this tool pass but won't compile to working code. + # See the testtagsguards.sh script for details.) + icu4c-clang: + name: ICU4C Build/Test, Ubuntu/Clang, new data + runs-on: ubuntu-latest + needs: genicudata + steps: + - name: Clone ICU + uses: actions/checkout@v2 + with: + repository: ${{ github.event.inputs.icu-repo }} + ref: ${{ github.event.inputs.icu-ref }} + lfs: false + - name: Download icu-data.zip + uses: actions/download-artifact@v2 + with: + name: icu-data + path: . + - name: Unpack icu-data.zip + run: cd icu4c/source && rm -rf data && unzip -o ../../icu-data.zip + - name: ICU4C with clang + env: + CPPFLAGS: -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 + CFLAGS: -Wimplicit-fallthrough + CXXFLAGS: -Wimplicit-fallthrough + run: | + sudo apt-get -y install doxygen; + cd icu4c/source; + ./runConfigureICU Linux; + make -j 2; + make dist + - name: Upload icu4c + uses: actions/upload-artifact@v2 + with: + name: icu4c + path: icu4c/source/dist + - name: ICU4C with clang test + env: + CPPFLAGS: -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 + CFLAGS: -Wimplicit-fallthrough + CXXFLAGS: -Wimplicit-fallthrough + run: | + cd icu4c/source; + make -j 2 check; + ( cd test/depstest && python3 depstest.py ../../../source/ ); + ( cd .. && source/test/hdrtst/testtagsguards.sh ); + icu4j-java16: + name: ICU4J Build/Test, Java 16, new data + runs-on: ubuntu-latest + needs: genicudata + steps: + - name: Clone ICU + uses: actions/checkout@v2 + with: + repository: ${{ github.event.inputs.icu-repo }} + ref: ${{ github.event.inputs.icu-ref }} + lfs: true + - name: Checkout lfs objects + run: git lfs pull + - name: Download icu-data.zip + uses: actions/download-artifact@v2 + with: + name: icu-data + path: . + - name: Unpack icu-data.zip + run: cd icu4c/source && rm -rf data && unzip -o ../../icu-data.zip + - name: Generate ICU4J data + run: cd icu4c/source && ./runConfigureICU Linux && make -j2 && make -C data icu4j-data-install ICU4J_ROOT=$(cd ../../icu4j ; pwd) + - uses: actions/setup-java@v1 + with: + java-version: '16' + - name: ICU4J Build + run: | + cd icu4j; + ant init; + ant jar; + ant releaseBinaries; + - name: Upload icu4j + uses: actions/upload-artifact@v2 + with: + name: icu4j + path: icu4j/release + - name: ICU4J Test + run: | + ant check; + ant localespiCheck; + - name: List failures (if any) + run: | + [ -d icu4j/out/junit-results ] && cd icu4j && cat `find out/junit-results -name "*.txt" -exec grep -l FAILED {} \;`; + if: ${{ failure() }}