|
| 1 | +name: CI jobs |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + - staging |
| 7 | + - r[0-9]+.* |
| 8 | + - bazelcism-superclean2000-214 # temporary |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + - r[0-9]+.* |
| 13 | + types: [opened, reopened, synchronize, labeled, unlabeled] |
| 14 | +env: |
| 15 | + STAGING_PROFILE_ID: 46f80d0729c92d |
| 16 | + GCP_CREDS: ${{ secrets.GCP_CREDS }} |
| 17 | +jobs: |
| 18 | + check-format: |
| 19 | + if: github.event_name == 'pull_request' |
| 20 | + runs-on: ubuntu-18.04 |
| 21 | + steps: |
| 22 | + - name: Configure Java |
| 23 | + uses: actions/setup-java@v2 |
| 24 | + with: |
| 25 | + distribution: 'adopt' |
| 26 | + java-version: '17' |
| 27 | + - name: Checkout repository |
| 28 | + uses: actions/checkout@v1 |
| 29 | + - name: Build project |
| 30 | + run: | |
| 31 | + gcc --version |
| 32 | + mvn -version |
| 33 | + mvn clean install -Pjdk17 -B -U -e -Dlint.skip=true -Dmaven.test.skip=true |
| 34 | + - name: Run format checks |
| 35 | + run: | |
| 36 | + mvn spotless:check -Pjdk17 -B -U -e |
| 37 | + prepare: |
| 38 | + runs-on: ubuntu-18.04 |
| 39 | + outputs: |
| 40 | + stagingRepositoryId: ${{ steps.staging.outputs.stagingRepositoryId }} |
| 41 | + steps: |
| 42 | + - name: Create staging repository |
| 43 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') |
| 44 | + id: staging |
| 45 | + run: | |
| 46 | + echo "Creating staging repository with profile $STAGING_PROFILE_ID" |
| 47 | + echo "<promoteRequest><data><description>Releasing TF Java - created by CI build</description></data></promoteRequest>" > request.xml |
| 48 | + curl -X POST -d @request.xml -s -o response.xml -u ${{ secrets.CI_DEPLOY_USERNAME }}:${{ secrets.CI_DEPLOY_PASSWORD }} -H "Content-Type:application/xml" \ |
| 49 | + https://oss.sonatype.org/service/local/staging/profiles/$STAGING_PROFILE_ID/start |
| 50 | + STAGING_REPOSITORY_ID=`awk -F'[<>]' '/stagedRepositoryId/{print $3}' response.xml` |
| 51 | + echo "Staging repository created: $STAGING_REPOSITORY_ID" |
| 52 | + echo "::set-output name=stagingRepositoryId::$STAGING_REPOSITORY_ID" |
| 53 | + linux-x86_64: |
| 54 | + if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'CI build') |
| 55 | + runs-on: ubuntu-18.04 |
| 56 | + needs: prepare |
| 57 | + strategy: |
| 58 | + matrix: |
| 59 | + ext: ["", -gpu] #, -mkl, -mkl-gpu] |
| 60 | + steps: |
| 61 | + - name: Configure Java |
| 62 | + uses: actions/setup-java@v2 |
| 63 | + with: |
| 64 | + distribution: 'adopt' |
| 65 | + java-version: '11' |
| 66 | + - name: Checkout repository |
| 67 | + uses: actions/checkout@v1 |
| 68 | + - name: Build project |
| 69 | + run: | |
| 70 | + gcc --version |
| 71 | + mvn -version |
| 72 | + [[ "${{ github.event_name }}" == "push" ]] && MAVEN_PHASE=deploy || MAVEN_PHASE=install |
| 73 | + echo "<settings><servers><server><id>ossrh</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml |
| 74 | + echo Executing Maven $MAVEN_PHASE |
| 75 | + mvn clean $MAVEN_PHASE -B -U -e -Djavacpp.platform=linux-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }} "-Dnative.build.flags=$BAZEL_CACHE" |
| 76 | + macosx-x86_64: |
| 77 | + if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'CI build') |
| 78 | + runs-on: macos-10.15 |
| 79 | + needs: prepare |
| 80 | + strategy: |
| 81 | + matrix: |
| 82 | + ext: [""] # , -mkl] |
| 83 | + steps: |
| 84 | + - name: Configure Java |
| 85 | + uses: actions/setup-java@v2 |
| 86 | + with: |
| 87 | + distribution: 'adopt' |
| 88 | + java-version: '11' |
| 89 | + - name: Checkout repository |
| 90 | + uses: actions/checkout@v1 |
| 91 | + - name: Build project |
| 92 | + run: | |
| 93 | + clang --version |
| 94 | + mvn -version |
| 95 | + [[ "${{ github.event_name }}" == "push" ]] && MAVEN_PHASE=deploy || MAVEN_PHASE=install |
| 96 | + echo "<settings><servers><server><id>ossrh</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml |
| 97 | + echo Executing Maven $MAVEN_PHASE |
| 98 | + mvn clean $MAVEN_PHASE -B -U -e -Djavacpp.platform=macosx-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }} "-Dnative.build.flags=$BAZEL_CACHE" |
| 99 | + windows-x86_64: |
| 100 | + if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'CI build') |
| 101 | + runs-on: windows-2019 |
| 102 | + needs: prepare |
| 103 | + strategy: |
| 104 | + matrix: |
| 105 | + ext: ["", -gpu] #, -mkl, -mkl-gpu] |
| 106 | + steps: |
| 107 | + - name: Configure page file |
| 108 | + uses: al-cheb/configure-pagefile-action@v1.2 |
| 109 | + with: |
| 110 | + minimum-size: 8GB |
| 111 | + maximum-size: 16GB |
| 112 | + disk-root: "C:" |
| 113 | + - name: Install environment |
| 114 | + shell: cmd |
| 115 | + run: | |
| 116 | + set "PATH=C:\msys64\usr\bin;%PATH%" |
| 117 | + echo Removing broken stuff from WSL and MSYS2 |
| 118 | + rm "C:/WINDOWS/system32/bash.EXE" "C:/msys64/usr/bin/python.exe" "C:/msys64/usr/bin/python3.exe" |
| 119 | + python -m pip install numpy six |
| 120 | + echo Removing old versions of MSVC that interfere with Bazel |
| 121 | + bash.exe -lc "find 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/' -iname '14.1*' -exec rm -Rf {} \;" |
| 122 | + set "EXT=${{ matrix.ext }}" |
| 123 | + echo %JAVA_HOME% |
| 124 | + - name: Configure Java |
| 125 | + uses: actions/setup-java@v2 |
| 126 | + with: |
| 127 | + distribution: 'adopt' |
| 128 | + java-version: '11' |
| 129 | + - name: Checkout repository |
| 130 | + uses: actions/checkout@v1 |
| 131 | + - name: Build project |
| 132 | + shell: cmd |
| 133 | + run: | |
| 134 | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 |
| 135 | + set "PATH=C:\msys64\usr\bin;C:\bazel;C:\Program Files\Git\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v11.2\libnvvp;%PATH%" |
| 136 | + echo Shorten work paths to prevent Bazel from reaching MAX_PATH limit |
| 137 | + set "TEST_TMPDIR=C:\tmp" |
| 138 | + set "TMPDIR=C:\tmp" |
| 139 | + set "TEMP=C:\tmp" |
| 140 | + set "TMP=C:\tmp" |
| 141 | + mkdir C:\tmp |
| 142 | + bash --version |
| 143 | + git --version |
| 144 | + cl |
| 145 | + call mvn -version |
| 146 | + if "${{ github.event_name }}" == "push" (set MAVEN_PHASE=deploy) else (set MAVEN_PHASE=install) |
| 147 | + echo ^<settings^>^<servers^>^<server^>^<id^>ossrh^</id^>^<username^>${{ secrets.CI_DEPLOY_USERNAME }}^</username^>^<password^>${{ secrets.CI_DEPLOY_PASSWORD }}^</password^>^</server^>^</servers^>^</settings^> > %USERPROFILE%\.m2\settings.xml |
| 148 | + set "SKIP_EXPORT=true" |
| 149 | + echo Executing Maven %MAVEN_PHASE% |
| 150 | + call mvn clean %MAVEN_PHASE% -B -U -e -Djavacpp.platform=windows-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }} "-Dnative.build.flags=%BAZEL_CACHE%" |
| 151 | + if ERRORLEVEL 1 exit /b |
| 152 | + deploy: |
| 153 | + if: github.event_name == 'push' && contains(github.ref, 'master') |
| 154 | + needs: [linux-x86_64, macosx-x86_64, windows-x86_64] |
| 155 | + runs-on: ubuntu-18.04 |
| 156 | + steps: |
| 157 | + - name: Configure Java |
| 158 | + uses: actions/setup-java@v2 |
| 159 | + with: |
| 160 | + distribution: 'adopt' |
| 161 | + java-version: '11' |
| 162 | + - name: Checkout repository |
| 163 | + uses: actions/checkout@v1 |
| 164 | + - name: Deploy snapshot artifacts |
| 165 | + run: | |
| 166 | + echo "<settings><servers><server><id>ossrh</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > settings.xml |
| 167 | + bash deploy.sh |
0 commit comments