deeplearning4j/deeplearning4j

View on GitHub
.github/workflows/build-deploy-linux-cuda-10.2-arm64.yml

Summary

Maintainability
Test Coverage
on:
  workflow_dispatch:
    inputs:
      buildThreads:
        description: 'Build threads for libnd4j. Used to control memory usage of builds.'
        required: true
        default: 4

      deployToReleaseStaging:
        description: 'Whether to deploy to release staging or not.'
        required: false
        default: 0

      releaseVersion:
        description: 'Release version target'
        required: false
        default: 1.0.0-M3

      serverId:
        description: 'Server id to publish to'
        required: false
        default: ossrh


      snapshotVersion:
        description: 'Snapshot version target'
        required: false
        default: 1.0.0-SNAPSHOT

      releaseRepoId:
        description: 'Release repository id'
        required: false
        default:

      mvnFlags:
        description: "Extra maven flags (must escape input yourself if used)"
        required: false
        default:

      libnd4jUrl:
        description: 'Sets a libnd4j download url for this build. LIBND4J_HOME will automatically be set. Should be used when only needing to build other modules.'
        required: false
        default:


      runsOn:
        description: 'System to run on'
        required: false
        default: ubuntu-20.04

      debug_enabled:
        description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
        required: false
        default: false

jobs:
  linux-arm64:
    runs-on: ${{ github.event.inputs.runsOn }}
    steps:
      - uses: AutoModality/action-clean@v1
      - name: Cancel Previous Runs
        uses: styfle/cancel-workflow-action@0.8.0
        with:
          access_token: ${{ github.token }}
      - uses: actions/checkout@v2
      - uses: ./.github/actions/set-linux-distro-version
      - uses: ./.github/actions/update-deps-linux
      - uses: konduitai/cuda-install/.github/actions/install-cuda-ubuntu@master
        env:
            cuda: 10.2
            GCC: 7
      - name: Cache cmake install
        uses: actions/cache@v2
        id: cache-cmake
        with:
          path: /opt/cmake
          key: ${{ runner.os }}-cmake
          restore-keys: ${{ runner.os }}-cmake
      - name: Cache protobuf install
        uses: actions/cache@v2
        id: cache-protobuf
        with:
          path: /opt/protobuf
          key: ${{ runner.os }}-protobuf
          restore-keys: ${{ runner.os }}-protobuf
      - uses: ./.github/actions/install-protobuf-linux
        if: steps.cache-protobuf.outputs.cache-hit != 'true'
      - uses: ./.github/actions/install-cmake-linux
        if: steps.cache-cmake.outputs.cache-hit != 'true'
      - name: Set up Java for publishing to OSSRH
        uses: actions/setup-java@v2
        with:
          java-version: 11
          distribution: 'temurin'
          server-id:  ${{ github.event.inputs.serverId }}
          server-username: MAVEN_USERNAME
          server-password: MAVEN_PASSWORD
          gpg-private-key: ${{ secrets.SONATYPE_GPG_KEY }}
          gpg-passphrase: MAVEN_GPG_PASSPHRASE
          cache: 'maven'
      - name: Build on  linux-arm64
        shell: bash
        env:
          MAVEN_GPG_KEY: ${{ secrets.SONATYPE_GPG_KEY }}
          DEBIAN_FRONTEND: noninteractive
          GITHUB_TOKEN:  ${{ secrets.GITHUB_TOKEN }}
          DEPLOY: 1
          BUILD_USING_MAVEN: 1
          TARGET_OS: linux
          CURRENT_TARGET: jetson-arm64
          LIBND4J_CLASSIFIER: linux-arm64
          CUDA_VER: 10.2
          PUBLISH_TO: ossrh
          DEPLOY_TO: ossrh
          MAVEN_USERNAME: ${{ secrets.SONATYPE_USER_1 }}
          MAVEN_PASSWORD: ${{ secrets.SONATYPE_USER1_PASS }}
          MAVEN_GPG_PASSPHRASE: ${{ secrets.PACKAGES_GPG_PASS }}
          LIBND4J_BUILD_THREADS: ${{ github.event.inputs.buildThreads }}
          PROTO_EXEC: /opt/protobuf/bin/protoc
          PERFORM_RELEASE: ${{ github.event.inputs.deployToReleaseStaging }}
          RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
          SNAPSHOT_VERSION: ${{ github.event.inputs.snapshotVersion }}
          RELEASE_REPO_ID: ${{ github.event.inputs.releaseRepoId }}
          MODULES: ${{ github.event.inputs.mvnFlags }}
          LIBND4J_FILE_NAME: ${{ matrix.libnd4j_file_download }}

        run: |
          echo "libnd4j build threads ${{ github.event.inputs.buildThreads }}"
          echo "deploy to release staging repo or not ${{ github.event.inputs.deployToReleaseStaging }}"
          echo "release version ${{ github.event.inputs.releaseVersion }}"
          echo "snapshot version ${{ github.event.inputs.snapshotVersion }}"
          echo "debug enabled ${{ github.event.inputs.debug_enabled }}"
          echo "maven flags ${{ github.event.inputs.mvnFlags }}"
          echo "snapshot version ${{ github.event.inputs.snapshotVersion }}"
          echo "server id ${{ github.event.inputs.serverId }}"
          echo "release repo id ${{ github.event.inputs.releaseRepoId }}"

          sudo sysctl vm.overcommit_memory=2
          export PATH=/opt/protobuf/bin:/opt/cmake/bin:$PATH
          mvn --version
          cmake --version
          protoc --version
          if ! [[ -z "$LIBND4J_FILE_NAME" ]]; then
              export MODULES="$MODULES -pl :nd4j-cuda-10.2-preset,:nd4j-cuda-10.2,:nd4j-cuda-10.2-platform,:nd4j-native-api"
             else
                 export MODULES="$MODULES -pl :nd4j-cuda-10.2-preset,:nd4j-cuda-10.2,libnd4j,:nd4j-cuda-10.2-platform,:nd4j-native-api"
          fi
          
          # download libnd4j from a url and set it up if LIBND4J_FILE_NAME is defined
          bash ./bootstrap-libnd4j-from-url.sh linux cuda 10.2 arm64
          ${GITHUB_WORKSPACE}/libnd4j/pi_build.sh