|
1 | 1 | name: Deploy on Ubuntu |
2 | 2 | description: "Deploy on Ubuntu" |
3 | 3 | inputs: |
| 4 | + snapshot-repo-url: |
| 5 | + description: "The URL of the maven repository" |
| 6 | + required: false |
| 7 | + release-repo-url: |
| 8 | + description: "The URL of the maven repository" |
| 9 | + required: false |
| 10 | + repo-username: |
| 11 | + description: "The username for the maven repository" |
| 12 | + required: false |
| 13 | + repo-password: |
| 14 | + description: "The password for the maven repository" |
| 15 | + required: false |
4 | 16 | gradle-cache-encryption-key: |
5 | | - description: 'The encryption key for the Gradle cache.' |
| 17 | + description: "The encryption key for the gradle cache" |
6 | 18 | required: false |
7 | | - tests: |
8 | | - description: 'Run tests' |
9 | | - default: 'false' |
10 | | - publish: |
11 | | - description: 'Publish the release' |
12 | | - default: 'true' |
13 | | - disable-cache: |
14 | | - description: 'Disable cache' |
15 | | - default: 'false' |
16 | 19 | runs: |
17 | 20 | using: composite |
18 | 21 | steps: |
19 | | - - name: Install environment |
20 | | - shell: bash |
21 | | - env: |
22 | | - GITHUB_EVENT_HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} |
23 | | - run: | |
24 | | - export SUDO=$(which sudo) |
25 | | - echo "SUDO=$SUDO" >> $GITHUB_ENV |
26 | | - if [[ -z "$SUDO" ]]; then |
27 | | - echo "Fixing HOME to /root (was '$HOME')" |
28 | | - export HOME=/root |
29 | | - echo "HOME=$HOME" >> $GITHUB_ENV |
30 | | - fi |
31 | | - cd $HOME |
32 | | - |
33 | | - # Free disk space by removing some unused system components |
34 | | - $SUDO rm -rf /usr/local/lib/android |
35 | | - $SUDO rm -rf /usr/share/dotnet |
36 | | - |
37 | | - # Allocate a swapfile on Linux as it's not enabled by default. Needed for pytorch and mkl. |
38 | | - $SUDO fallocate -l 4GB /swapfile |
39 | | - $SUDO chmod 600 /swapfile |
40 | | - $SUDO mkswap /swapfile |
41 | | - $SUDO swapon /swapfile |
42 | | - |
43 | | - mkdir -p .ccache |
44 | | - echo "max_size = 2.0G" > .ccache/ccache.conf |
45 | | - echo "hash_dir = false" >> .ccache/ccache.conf |
46 | | - echo "sloppiness = file_macro,include_file_ctime,include_file_mtime,pch_defines,time_macros" >> .ccache/ccache.conf |
47 | | - |
48 | | - export ARCH=amd64 |
49 | | - export PREFIX=x86_64-linux-gnu |
50 | | - if [[ "$CI_DEPLOY_PLATFORM" == "linux-arm" ]]; then |
51 | | - export ARCH=armhf |
52 | | - export PREFIX=arm-linux-gnueabihf |
53 | | - export USERLAND_BUILDME="buildme" |
54 | | - elif [[ "$CI_DEPLOY_PLATFORM" == "linux-arm64" ]]; then |
55 | | - export ARCH=arm64 |
56 | | - export ARCH_CUDA=sbsa |
57 | | - export PREFIX=aarch64-linux-gnu |
58 | | - export CUDA=cuda-repo-rhel8-12-3-local-12.3.2_545.23.08-1.aarch64.rpm |
59 | | - export CUDNN=8.9.7.29-1.cuda12.2.aarch64 |
60 | | - export NCCL=2.19.3-1+cuda12.3.aarch64 |
61 | | - export NVCOMP=nvcomp_3.0.5_SBSA_12.x |
62 | | - export USERLAND_BUILDME="buildme --aarch64" |
63 | | - elif [[ "$CI_DEPLOY_PLATFORM" == "linux-ppc64le" ]]; then |
64 | | - export ARCH=ppc64el |
65 | | - export ARCH_CUDA=ppc64le |
66 | | - export PREFIX=powerpc64le-linux-gnu |
67 | | - export CUDA=cuda-repo-rhel8-12-3-local-12.3.2_545.23.08-1.ppc64le.rpm |
68 | | - export CUDNN=8.9.7.29-1.cuda12.2.ppc64le |
69 | | - export NCCL=2.19.3-1+cuda12.3.ppc64le |
70 | | - elif [[ "$CI_DEPLOY_PLATFORM" == "linux-x86" ]]; then |
71 | | - export ARCH=i386 |
72 | | - export PREFIX=i686-linux-gnu |
73 | | - elif [[ "$CI_DEPLOY_PLATFORM" == "linux-x86_64" ]]; then |
74 | | - export ARCH=amd64 |
75 | | - export ARCH_CUDA=x86_64 |
76 | | - export PREFIX=x86_64-linux-gnu |
77 | | - export CUDA=cuda-repo-rhel8-12-3-local-12.3.2_545.23.08-1.x86_64.rpm |
78 | | - export CUDNN=8.9.7.29-1.cuda12.2.x86_64 |
79 | | - export NCCL=2.19.3-1+cuda12.3.x86_64 |
80 | | - export NVCOMP=nvcomp_3.0.5_x86_64_12.x |
81 | | - fi |
82 | | - echo "ARCH=$ARCH" >> $GITHUB_ENV |
83 | | - echo "PREFIX=$PREFIX" >> $GITHUB_ENV |
84 | | - |
85 | | - $SUDO dpkg --list |
86 | | - |
87 | | - $SUDO apt-get update |
88 | | - $SUDO apt-get -y install gnupg |
89 | | - source /etc/os-release |
90 | | - export CODENAME=$UBUNTU_CODENAME |
91 | | - |
92 | | - if [[ ! "$ARCH" == "amd64" ]]; then |
93 | | - # https://github.com/actions/runner-images/issues/675 |
94 | | - $SUDO gem install apt-spy2 |
95 | | - $SUDO apt-spy2 check |
96 | | - $SUDO apt-spy2 fix --commit |
97 | | - $SUDO sed -i 's/azure\.//' /etc/apt/apt-mirrors.txt /etc/apt/sources.list |
98 | | - $SUDO cat /etc/apt/apt-mirrors.txt /etc/apt/sources.list |
99 | | - $SUDO apt-get update |
100 | | - |
101 | | - # https://github.com/actions/runner-images/issues/4589 |
102 | | - $SUDO apt-add-repository -y ppa:ondrej/php |
103 | | - $SUDO apt-get -y install ppa-purge |
104 | | - $SUDO ppa-purge -y ppa:ondrej/php |
105 | | - fi |
106 | | - |
107 | | - if [[ "$ARCH" == "i386" ]]; then |
108 | | - $SUDO dpkg --add-architecture $ARCH |
109 | | - TOOLCHAIN="gcc-$PREFIX g++-$PREFIX gfortran-$PREFIX" |
110 | | - elif [[ ! "$ARCH" == "amd64" ]]; then |
111 | | - echo "Adding $ARCH architecture" |
112 | | - $SUDO dpkg --add-architecture $ARCH |
113 | | - $SUDO sed -i 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list |
114 | | - $SUDO sed -i 's/deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list |
115 | | - $SUDO echo deb [arch=$ARCH] http://ports.ubuntu.com/ubuntu-ports $CODENAME main restricted universe multiverse | $SUDO tee -a /etc/apt/sources.list |
116 | | - $SUDO echo deb [arch=$ARCH] http://ports.ubuntu.com/ubuntu-ports $CODENAME-updates main restricted universe multiverse | $SUDO tee -a /etc/apt/sources.list |
117 | | - $SUDO echo deb [arch=$ARCH] http://ports.ubuntu.com/ubuntu-ports $CODENAME-backports main restricted universe multiverse | $SUDO tee -a /etc/apt/sources.list |
118 | | - $SUDO echo deb [arch=$ARCH] http://ports.ubuntu.com/ubuntu-ports $CODENAME-security main restricted universe multiverse | $SUDO tee -a /etc/apt/sources.list |
119 | | - TOOLCHAIN="gcc-$PREFIX g++-$PREFIX gfortran-$PREFIX linux-libc-dev-$ARCH-cross binutils-multiarch" |
120 | | - fi |
121 | | - echo "sources.list:" |
122 | | - cat /etc/apt/sources.list |
123 | | - for f in /etc/apt/sources.list.d/*.list; do echo "$f:"; cat $f; done |
124 | | - $SUDO apt-get update |
125 | | - $SUDO apt-get -y install gcc-multilib g++-multilib gfortran-multilib python3 python2.7 python3-minimal python2.7-minimal rpm libasound2-dev:$ARCH freeglut3-dev:$ARCH libfontconfig-dev:$ARCH libgtk2.0-dev:$ARCH libusb-dev:$ARCH libusb-1.0-0-dev:$ARCH libffi-dev:$ARCH libbz2-dev:$ARCH zlib1g-dev:$ARCH libxcb1-dev:$ARCH libpulse-dev:$ARCH libdrm-dev:$ARCH libva-dev:$ARCH |
126 | | - $SUDO apt-get -y install pkgconf ccache clang $TOOLCHAIN openjdk-8-jdk ant python2 python3-pip swig git file wget unzip tar bzip2 gzip patch autoconf-archive autogen automake cmake make libtool bison flex perl nasm ragel curl libcurl4-openssl-dev libssl-dev libffi-dev libbz2-dev zlib1g-dev rapidjson-dev |
127 | | - |
128 | | - export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ |
129 | | - echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV |
130 | | - ln -sf $JAVA_HOME /usr/lib/jvm/default-java |
131 | | - find /usr/lib/jvm/default-java/ |
132 | | - |
133 | | - # install vulkan sdk |
134 | | - echo Installing Vulkan-SDK |
135 | | - if [[ "$CODENAME" == "jammy" ]]; then |
136 | | - curl -s https://packages.lunarg.com/lunarg-signing-key-pub.asc | $SUDO tee /etc/apt/trusted.gpg.d/lunarg.asc >/dev/null |
137 | | - $SUDO curl -s -o /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-jammy.list https://packages.lunarg.com/vulkan/1.3.280/lunarg-vulkan-1.3.280-jammy.list |
138 | | - $SUDO sed -i 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-jammy.list |
139 | | - $SUDO sed -i 's/deb-src http/deb-src [arch=amd64] http/g' /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-jammy.list |
140 | | - else |
141 | | - curl -s https://packages.lunarg.com/lunarg-signing-key-pub.asc | $SUDO apt-key add - |
142 | | - $SUDO curl -s -o /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-focal.list https://packages.lunarg.com/vulkan/1.3.280/lunarg-vulkan-1.3.280-focal.list |
143 | | - $SUDO sed -i 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-focal.list |
144 | | - $SUDO sed -i 's/deb-src http/deb-src [arch=amd64] http/g' /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-focal.list |
145 | | - fi |
146 | | - $SUDO apt-get update && $SUDO apt-get install -y libvulkan1 libvulkan-dev vulkan-sdk |
147 | | - |
148 | | - if [[ -n ${USERLAND_BUILDME:-} ]]; then |
149 | | - curl -LOJ https://github.com/raspberrypi/userland/archive/master.tar.gz |
150 | | - tar -xzf userland-master.tar.gz |
151 | | - pushd userland-master |
152 | | - bash $USERLAND_BUILDME |
153 | | - popd |
154 | | - export USERLAND_PATH=$(pwd)/userland-master/ |
155 | | - echo "USERLAND_PATH=$USERLAND_PATH" >> $GITHUB_ENV |
156 | | - fi |
157 | | - |
158 | | - if [[ $CI_DEPLOY_PLATFORM == android-* ]]; then |
159 | | - curl -LO https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip |
160 | | - unzip -qq android-ndk-r21e-linux-x86_64.zip |
161 | | - ln -sf android-ndk-r21e android-ndk |
162 | | - export MAVEN_OPTIONS="-Djavacpp.platform.root=$(pwd)/android-ndk/ -Djava.library.path=" |
163 | | - else |
164 | | - export MAVEN_OPTIONS="-Djavacpp.platform.compiler=$PREFIX-g++ -Djava.library.path=/usr/$PREFIX/lib/:/usr/lib/$PREFIX/:$USERLAND_PATH/build/lib/" |
165 | | - fi |
166 | | - |
167 | | - if [[ -n ${ARCH_CUDA:-} ]] && [[ -n ${CI_DEPLOY_NEED_CUDA:-} ]]; then |
168 | | - echo Installing CUDA, cuDNN, nvCOMP, etc |
169 | | - curl -LO https://developer.download.nvidia.com/compute/cuda/12.3.2/local_installers/$CUDA |
170 | | - curl -LO https://developer.download.nvidia.com/compute/cuda/repos/rhel8/$ARCH_CUDA/libcudnn8-$CUDNN.rpm |
171 | | - curl -LO https://developer.download.nvidia.com/compute/cuda/repos/rhel8/$ARCH_CUDA/libcudnn8-devel-$CUDNN.rpm |
172 | | - curl -LO https://developer.download.nvidia.com/compute/cuda/repos/rhel8/$ARCH_CUDA/libnccl-$NCCL.rpm |
173 | | - curl -LO https://developer.download.nvidia.com/compute/cuda/repos/rhel8/$ARCH_CUDA/libnccl-devel-$NCCL.rpm |
174 | | - |
175 | | - $SUDO rpm -i --force --ignorearch --nodeps $CUDA libcudnn*.rpm libnccl*.rpm |
176 | | - rm -f *.rpm *.tgz *.txz *.tar.* |
177 | | - pushd /var/cuda-repo-rhel8-12-3-local/; $SUDO rpm -i --force --ignorearch --nodeps cuda*.rpm libc*.rpm libn*.rpm; $SUDO rm *.rpm; popd |
178 | | - $SUDO ln -sf /usr/local/cuda/lib64/ /usr/local/cuda/lib |
179 | | - $SUDO ln -sf /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/libcuda.so |
180 | | - $SUDO ln -sf /usr/local/cuda/lib64/stubs/libnvidia-ml.so /usr/local/cuda/lib64/libnvidia-ml.so |
181 | | - $SUDO mv /usr/include/cudnn* /usr/include/nccl* /usr/local/cuda/include/ |
182 | | - $SUDO mv /usr/lib64/libcudnn* /usr/lib64/libnccl* /usr/local/cuda/lib64/ |
183 | | - |
184 | | - if [[ -n ${NVCOMP:-} ]]; then |
185 | | - curl -LO https://developer.download.nvidia.com/compute/nvcomp/3.0.5/local_installers/$NVCOMP.tgz |
186 | | - $SUDO tar -xvf $NVCOMP.tgz -C /usr/local/cuda/lib64/ --strip-components=1 lib/ || $SUDO tar -xvf $NVCOMP.tgz -C /usr/local/cuda/lib64/ --strip-components=2 nvcomp-3.0.5-ctk-12.2/lib/ |
187 | | - $SUDO tar -xvf $NVCOMP.tgz -C /usr/local/cuda/include/ --strip-components=1 include/ || $SUDO tar -xvf $NVCOMP.tgz -C /usr/local/cuda/include/ --strip-components=2 nvcomp-3.0.5-ctk-12.2/include/ |
188 | | - rm -f $NVCOMP.tgz |
189 | | - fi |
190 | | - |
191 | | - # Work around issues with CUDA 10.2/11.x |
192 | | - $SUDO mv /usr/include/cublas* /usr/include/nvblas* /usr/local/cuda/include/ || true |
193 | | - $SUDO mv /usr/lib64/libcublas* /usr/lib64/libnvblas* /usr/local/cuda/lib64/ || true |
194 | | - for f in /usr/local/cuda/include/*_v8.h; do $SUDO ln -sf $f ${f:0:${#f}-5}.h; done |
195 | | - for f in /usr/local/cuda/lib64/libcudnn*so.8.*; do $SUDO ln -sf $f ${f:0:${#f}-4}; $SUDO ln -sf $f ${f:0:${#f}-6}; done |
196 | | - for f in /usr/local/cuda/lib64/*.so.10; do $SUDO ln -s $f $f.2; done |
197 | | - for f in /usr/local/cuda/lib64/*.so.10; do $SUDO ln -s $f ${f:0:${#f}-1}1; done |
198 | | - $SUDO ln -s libcudart.so.11.0 /usr/local/cuda/lib64/libcudart.so.11.1 |
199 | | - $SUDO ln -s libcudart.so.11.0 /usr/local/cuda/lib64/libcudart.so.11.2 |
200 | | - $SUDO ln -s libcudart.so.11.0 /usr/local/cuda/lib64/libcudart.so.11.3 |
201 | | - $SUDO ln -s libcudart.so.11.0 /usr/local/cuda/lib64/libcudart.so.11.4 |
202 | | - $SUDO ln -s libcudart.so.11.0 /usr/local/cuda/lib64/libcudart.so.11.5 |
203 | | - $SUDO ln -s libcudart.so.11.0 /usr/local/cuda/lib64/libcudart.so.11.6 |
204 | | - $SUDO ln -s libcudart.so.11.0 /usr/local/cuda/lib64/libcudart.so.11.7 |
205 | | - $SUDO ln -s libcudart.so.11.0 /usr/local/cuda/lib64/libcudart.so.11.8 |
206 | | - $SUDO cp /usr/local/cuda/lib64/stubs/libcuda.so /usr/lib64/libcuda.so |
207 | | - $SUDO cp /usr/local/cuda/lib64/stubs/libcuda.so /usr/lib64/libcuda.so.1 |
208 | | - $SUDO cp /usr/local/cuda/lib64/stubs/libnvidia-ml.so /usr/lib64/libnvidia-ml.so |
209 | | - $SUDO cp /usr/local/cuda/lib64/stubs/libnvidia-ml.so /usr/lib64/libnvidia-ml.so.1 |
210 | | - $SUDO sed -i s/cublas_v2.h/cublas_api.h/g /usr/local/cuda/include/cublasXt.h /usr/local/cuda/include/cusolverDn.h /usr/local/cuda/include/cusolverSp.h |
211 | | - $SUDO sed -i /block_merge_sort.cuh/d /usr/local/cuda/include/cub/cub.cuh |
212 | | - $SUDO sed -i /device_merge_sort.cuh/d /usr/local/cuda/include/cub/cub.cuh |
213 | | - $SUDO sed -i /device_segmented_sort.cuh/d /usr/local/cuda/include/cub/cub.cuh |
214 | | - $SUDO sed -i /warp_merge_sort.cuh/d /usr/local/cuda/include/cub/cub.cuh |
215 | | - |
216 | | - # Remove downloaded archives and unused libraries to avoid running out of disk space |
217 | | - $SUDO rm -f $(find /usr/local/cuda/ -name '*.a' -and -not -name libcudart_static.a -and -not -name libcudadevrt.a -and -not -name libnvcomp_device.a) |
218 | | - fi |
219 | | -
|
220 | | - - name: Set up JDK 11 |
221 | | - uses: actions/setup-java@v4 |
222 | | - with: |
223 | | - distribution: 'temurin' |
224 | | - java-version: '11' |
225 | | - - name: Setup Gradle |
226 | | - uses: gradle/actions/setup-gradle@v3 |
| 22 | + - uses: silenium-dev/actions/jni-natives/ubuntu@main |
227 | 23 | with: |
228 | | - cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }} |
229 | | - gradle-home-cache-cleanup: ${{ inputs.disable-cache == 'true' && 'false' || 'true' }} |
230 | | - build-scan-publish: true |
231 | | - build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" |
232 | | - build-scan-terms-of-use-agree: "yes" |
233 | | - add-job-summary-as-pr-comment: on-failure |
234 | | - cache-disabled: ${{ inputs.disable-cache }} |
235 | | - |
236 | | - - name: Publish release |
237 | | - shell: bash |
238 | | - if: "github.event_name == 'release'" |
239 | | - run: ./gradlew clean ${{ inputs.publish == 'true' && 'publish' || 'assemble' }} ${{ inputs.tests == 'true' && 'check' || '-x check -x test' }} -Pdeploy.kotlin=false -Pdeploy.native=true -Pdeploy.platform=${{ github.job }} -Pffmpeg.gpl=${{ matrix.gpl }} -Pdeploy.version=${{ github.event.release.tag_name }} --console=plain --info --configure-on-demand --parallel --build-cache --configuration-cache |
240 | | - |
241 | | - - name: Set outputs |
242 | | - id: vars |
243 | | - shell: bash |
244 | | - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT |
245 | | - - name: Publish snapshot |
246 | | - shell: bash |
247 | | - if: "github.event_name != 'release'" |
248 | | - run: ./gradlew clean ${{ inputs.publish == 'true' && 'publish' || 'assemble' }} ${{ inputs.tests == 'true' && 'check' || '-x check -x test' }} -Pdeploy.kotlin=false -Pdeploy.native=true -Pdeploy.platform=${{ github.job }} -Pffmpeg.gpl=${{ matrix.gpl }} -Pdeploy.version=${{ steps.vars.outputs.sha_short }}-dev --console=plain --info --configure-on-demand --parallel --build-cache --configuration-cache |
| 24 | + gradle-cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }} |
| 25 | + snapshot-repo-url: ${{ inputs.snapshot-repo-url }} |
| 26 | + release-repo-url: ${{ inputs.release-repo-url }} |
| 27 | + repo-username: ${{ secrets.REPOSILITE_USERNAME }} |
| 28 | + repo-password: ${{ secrets.REPOSILITE_PASSWORD }} |
| 29 | + tests: false |
| 30 | + java-version: 11 |
| 31 | + platform: ${{ github.job }} |
| 32 | + extra-gradle-args: "-Pffmpeg.gpl=${{ matrix.gpl }}" |
0 commit comments