diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73a731de1da..bf53d416287 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,9 +11,10 @@ on: - r[0-9]+.* types: [opened, reopened, synchronize, labeled, unlabeled] env: - STAGING_PROFILE_ID: 46f80d0729c92d - DEPLOY_SNAPSHOT: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }} - DEPLOY_RELEASE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') }} +# STAGING_PROFILE_ID: 46f80d0729c92d +# DEPLOY_SNAPSHOT: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }} +# DEPLOY_RELEASE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') }} + 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' @@ -36,37 +37,37 @@ jobs: - name: Run format checks run: | mvn spotless:check -Pjdk17 -B -U -e - prepare: - runs-on: ubuntu-22.04 - outputs: - repositoryUrl: ${{ steps.repository.outputs.repositoryUrl }} - steps: - - name: Create staging repository - if: env.DEPLOY_RELEASE == 'true' - id: staging - run: | - echo "Creating staging repository with profile $STAGING_PROFILE_ID" - echo "Releasing TF Java - created by CI build" > request.xml - curl -X POST -d @request.xml -s -o response.xml -u ${{ secrets.CI_DEPLOY_USERNAME }}:${{ secrets.CI_DEPLOY_PASSWORD }} -H "Content-Type:application/xml" \ - https://ossrh-staging-api.central.sonatype.com/service/local/staging/profiles/$STAGING_PROFILE_ID/start - export STAGING_REPOSITORY_ID=`awk -F'[<>]' '/stagedRepositoryId/{print $3}' response.xml` - echo "Staging repository created: $STAGING_REPOSITORY_ID" - echo "::set-output name=stagingRepositoryId::$STAGING_REPOSITORY_ID" - - name: Checkout repository - uses: actions/checkout@v6 - - name: Extract distribution repository URL - id: repository - run: | - if [[ "${{ env.DEPLOY_RELEASE }}" = "true" ]]; then - export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\\${project.distributionManagement.repository.url}" -DstagingRepositoryId=${{ steps.staging.outputs.stagingRepositoryId }}` - else - export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\\${project.distributionManagement.snapshotRepository.url}"` - fi - echo "Repository URL: $REPOSITORY_URL" - echo "::set-output name=repositoryUrl::$REPOSITORY_URL" +# prepare: +# runs-on: ubuntu-22.04 +# outputs: +# repositoryUrl: ${{ steps.repository.outputs.repositoryUrl }} +# steps: +# - name: Create staging repository +# if: env.DEPLOY_RELEASE == 'true' +# id: staging +# run: | +# echo "Creating staging repository with profile $STAGING_PROFILE_ID" +# echo "Releasing TF Java - created by CI build" > request.xml +# curl -X POST -d @request.xml -s -o response.xml -u ${{ secrets.CI_DEPLOY_USERNAME }}:${{ secrets.CI_DEPLOY_PASSWORD }} -H "Content-Type:application/xml" \ +# https://ossrh-staging-api.central.sonatype.com/service/local/staging/profiles/$STAGING_PROFILE_ID/start +# export STAGING_REPOSITORY_ID=`awk -F'[<>]' '/stagedRepositoryId/{print $3}' response.xml` +# echo "Staging repository created: $STAGING_REPOSITORY_ID" +# echo "::set-output name=stagingRepositoryId::$STAGING_REPOSITORY_ID" +# - name: Checkout repository +# uses: actions/checkout@v6 +# - name: Extract distribution repository URL +# id: repository +# run: | +# if [[ "${{ env.DEPLOY_RELEASE }}" = "true" ]]; then +# export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\\${project.distributionManagement.repository.url}" -DstagingRepositoryId=${{ steps.staging.outputs.stagingRepositoryId }}` +# else +# export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\\${project.distributionManagement.snapshotRepository.url}"` +# fi +# echo "Repository URL: $REPOSITORY_URL" +# echo "::set-output name=repositoryUrl::$REPOSITORY_URL" linux-arm64: runs-on: ubuntu-2204-arm64-2c - needs: prepare +# needs: prepare strategy: matrix: ext: [""] @@ -90,10 +91,11 @@ jobs: echo "central${{ secrets.CI_DEPLOY_USERNAME }}${{ secrets.CI_DEPLOY_PASSWORD }}" > $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 - if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' +# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' 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_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' +# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' + if: env.DEPLOY == 'true' uses: actions/upload-artifact@v4 with: name: native-artifact-${{ github.job }}${{ matrix.ext }} @@ -102,7 +104,7 @@ jobs: retention-days: 1 linux-x86_64: runs-on: ubuntu-22.04 - needs: prepare +# needs: prepare strategy: matrix: ext: ["", -gpu] @@ -121,10 +123,11 @@ jobs: echo "central${{ secrets.CI_DEPLOY_USERNAME }}${{ secrets.CI_DEPLOY_PASSWORD }}" > $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 - if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' +# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' 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_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' +# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' + if: env.DEPLOY == 'true' uses: actions/upload-artifact@v4 with: name: native-artifact-${{ github.job }}${{ matrix.ext }} @@ -133,7 +136,7 @@ jobs: retention-days: 1 macosx-arm64: runs-on: macos-14 - needs: prepare +# needs: prepare strategy: matrix: ext: [""] @@ -153,10 +156,11 @@ jobs: echo "central${{ secrets.CI_DEPLOY_USERNAME }}${{ secrets.CI_DEPLOY_PASSWORD }}" > $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 - if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' +# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' 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_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' +# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true' + if: env.DEPLOY == 'true' uses: actions/upload-artifact@v4 with: name: native-artifact-${{ github.job }}${{ matrix.ext }} @@ -165,7 +169,8 @@ jobs: retention-days: 1 deploy: - if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }} # DEPLOY_SNAPSHOT (releases should be signed and deployed manually from local machine) +# if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }} # DEPLOY_SNAPSHOT (releases should be signed and deployed manually from local machine) + if: env.DEPLOY == 'true' needs: [linux-x86_64, macosx-arm64, linux-arm64] runs-on: ubuntu-22.04 steps: