Update build.yml #338
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
| name: CI build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - staging | |
| - r[0-9]+.* | |
| pull_request: | |
| branches: | |
| - master | |
| - r[0-9]+.* | |
| types: [opened, reopened, synchronize, labeled, unlabeled] | |
| env: | |
| DEPLOY: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/r')) }} | |
| jobs: | |
| check-format: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Configure Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'adopt' | |
| java-version: '17' | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Build project | |
| run: | | |
| gcc --version | |
| mvn -version | |
| mvn clean install -Pjdk17 -B -U -e -Dlint.skip=true -Dmaven.test.skip=true | |
| - name: Run format checks | |
| run: | | |
| mvn spotless:check -Pjdk17 -B -U -e | |
| linux-arm64: | |
| runs-on: ubuntu-2204-arm64-2c | |
| strategy: | |
| matrix: | |
| ext: [""] | |
| steps: | |
| - name: Install environment | |
| run: | | |
| sudo apt update | |
| sudo apt install -y curl wget unzip tar git gcc g++ | |
| - name: Configure Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| architecture: 'aarch64' | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Build project | |
| run: | | |
| gcc --version | |
| mvn -version | |
| echo "<settings><servers><server><id>central</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml | |
| mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} | |
| - name: Build native artifact | |
| run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml package -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} | |
| - name: Upload native artifact | |
| if: env.DEPLOY == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-artifact-${{ github.job }}${{ matrix.ext }} | |
| path: tensorflow-core/tensorflow-core-native/target/tensorflow-core-native-*-${{ github.job }}*.jar | |
| if-no-files-found: error | |
| retention-days: 1 | |
| linux-x86_64: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| ext: ["", -gpu] | |
| steps: | |
| - name: Configure Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'adopt' | |
| java-version: '11' | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Build project | |
| run: | | |
| gcc --version | |
| mvn -version | |
| echo "<settings><servers><server><id>central</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml | |
| mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} | |
| - name: Build native artifact | |
| run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml package -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} | |
| - name: Upload native artifact | |
| if: env.DEPLOY == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-artifact-${{ github.job }}${{ matrix.ext }} | |
| path: tensorflow-core/tensorflow-core-native/target/tensorflow-core-native-*-${{ github.job }}*.jar | |
| if-no-files-found: error | |
| retention-days: 1 | |
| macosx-arm64: | |
| runs-on: macos-14 | |
| strategy: | |
| matrix: | |
| ext: [""] | |
| steps: | |
| - name: Configure Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| architecture: 'arm64' | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Build project | |
| run: | | |
| clang --version | |
| mvn -version | |
| echo "<settings><servers><server><id>central</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml | |
| mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} | |
| - name: Build native artifact | |
| run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml package -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} | |
| - name: Upload native artifact | |
| if: env.DEPLOY == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-artifact-${{ github.job }}${{ matrix.ext }} | |
| path: tensorflow-core/tensorflow-core-native/target/tensorflow-core-native-*-${{ github.job }}*.jar | |
| if-no-files-found: error | |
| retention-days: 1 | |
| deploy: | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
| needs: [linux-x86_64, macosx-arm64, linux-arm64] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Configure Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'adopt' | |
| java-version: '11' | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Download native artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: native-artifact-* | |
| path: tensorflow-core/tensorflow-core-native/target | |
| merge-multiple: true | |
| - name: Build and Deploy snapshot artifacts | |
| run: | | |
| java -version | |
| mvn -version | |
| echo "<settings><servers><server><id>central</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml | |
| mvn deploy -Pdeploying -B -e | |
| release: | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') }} | |
| needs: [linux-x86_64, macosx-arm64, linux-arm64] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Configure Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'adopt' | |
| java-version: '11' | |
| server-id: central | |
| gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE # Handled as an env variable name reference | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Download native artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: native-artifact-* | |
| path: tensorflow-core/tensorflow-core-native/target | |
| merge-multiple: true | |
| - name: Build and Deploy release artifacts | |
| env: | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| run: | | |
| java -version | |
| mvn -version | |
| echo "<settings><servers><server><id>central</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml | |
| mvn clean deploy -Pdeploying -Preleasing -B -e | |