forked from deeplearning4j/deeplearning4j
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (146 loc) · 6.46 KB
/
build-deploy-linux-arm64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
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
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/[email protected]
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@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: Setup libnd4j home if a download url is specified
shell: bash
run: |
mkdir "${GITHUB_WORKSPACE}/openblas_home"
cd "${GITHUB_WORKSPACE}/openblas_home"
wget https://repo1.maven.org/maven2/org/bytedeco/openblas/0.3.19-1.5.7/openblas-0.3.19-1.5.7-linux-arm64.jar
unzip openblas-0.3.19-1.5.7-linux-arm64.jar
cd ..
echo "OPENBLAS_PATH=${GITHUB_WORKSPACE}/openblas_home/org/bytedeco/openblas/linux-arm64" >> "$GITHUB_ENV"
cp ${GITHUB_WORKSPACE}/openblas_home/org/bytedeco/openblas/linux-arm64/libopenblas.so.0 ${GITHUB_WORKSPACE}/openblas_home/org/bytedeco/openblas/linux-arm64/libopenblas.so
if: ${{ github.event.inputs.libnd4jUrl != '' }}
- 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: arm64
LIBND4J_CLASSIFIER: linux-arm64
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: ${{ github.event.inputs.libnd4jUrl }}
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 }}"
echo "libnd4j file url ${{ github.event.inputs.libnd4jUrl }}"
sudo sysctl vm.overcommit_memory=2
export PATH=/opt/protobuf/bin:/opt/cmake/bin:$PATH
mvn --version
cmake --version
protoc --version
# download libnd4j from a url and set it up if LIBND4J_FILE_NAME is defined
echo "Executing bootstrap if exists"
bash ./bootstrap-libnd4j-from-url.sh linux arm64
if [ "${{ github.event.inputs.libnd4jUrl }}" != '' ]; then
echo "Building only java modules using a pre existing libnd4j home"
export MODULES="${MODULES} -pl :nd4j-native,:nd4j-native-preset --also-make -Dlibnd4jhome=${GITHUB_WORKSPACE}/libnd4j"
else
echo "Building all modules"
export MODULES="${MODULES} -pl :libnd4j,:nd4j-native,:nd4j-native-preset --also-make -Dlibnd4jhome=${GITHUB_WORKSPACE}/libnd4j"
fi
${GITHUB_WORKSPACE}/libnd4j/pi_build.sh