Files
deeplearning4j--deeplearning4j/.github/workflows/build-deploy-cross-platform.yml
T
2026-07-13 12:47:05 +08:00

140 lines
5.2 KiB
YAML

on:
workflow_dispatch:
inputs:
buildThreads:
description: 'Build threads for libnd4j. Used to control memory usage of builds.'
required: true
default: 2
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
snapshotVersion:
description: 'Release version target'
required: false
default: 1.0.0-SNAPSHOT
releaseRepoId:
description: 'Release repository id'
required: false
default:
serverId:
description: 'Server id to publish to'
required: false
default: central
runsOn:
description: 'System to run on'
required: false
default: ubuntu-22.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-x86_64:
runs-on: ${{ github.event.inputs.runsOn }}
steps:
- 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
- name: Cache cmake install
uses: actions/cache@v4
id: cache-cmake
with:
path: /opt/cmake
key: ${{ runner.os }}-cmake
restore-keys: ${{ runner.os }}-cmake
- name: Cache protobuf install
uses: actions/cache@v4
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@v4
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-x86_64
shell: bash
env:
MAVEN_GPG_KEY: ${{ secrets.SONATYPE_GPG_KEY }}
DEBIAN_FRONTEND: noninteractive
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_TO: central
MAVEN_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.PACKAGES_GPG_PASS }}
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 }}
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 "libnd4j url ${{ github.event.inputs.libnd4jUrl }}"
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
sudo apt-get autoremove
sudo apt-get clean
command="mvn -Possrh -pl !:blas-lapack-generator,!:libnd4j-gen -DskipTestResourceEnforcement=true -Djavacpp.platform=linux-x86_64 --batch-mode deploy -DskipTests"
if [ "$PERFORM_RELEASE" == 1 ]; then
echo "Performing release"
bash ${GITHUB_WORKSPACE}/release-specified-component.sh "${RELEASE_VERSION}" "${SNAPSHOT_VERSION}" "${RELEASE_REPO_ID}" "${command}"
else
echo "Running build and deploying to snapshots"
eval "$command"
fi
if [ "$PERFORM_RELEASE" == 1 ]; then
echo "Performing release"
bash ${GITHUB_WORKSPACE}/release-specified-component.sh "${RELEASE_VERSION}" "${SNAPSHOT_VERSION}" "${RELEASE_REPO_ID}" "${command}"
else
echo "Running build and deploying to snapshots"
eval "$command"
fi