Skip to content

Commit

Permalink
ci: install graalvm on docker
Browse files Browse the repository at this point in the history
  • Loading branch information
nmammeri committed Jul 11, 2024
1 parent 3670b62 commit f888d9a
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 50 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/build-wheels.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
#!/bin/bash
set -e -x

cd bindings/python
# # install graalvm
# yum install -y zip
# curl -s "https://get.sdkman.io" | sh -s -- -y
# source "$HOME/.sdkman/bin/sdkman-init.sh"

curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
rustup default 1.78.0
# sdk install java 22.0.1-graalce
# sdk use java 22.0.1-graalce
# echo "JAVA_HOME: $JAVA_HOME"

# # install rust
# curl https://sh.rustup.rs -sSf | sh -s -- -y
# source $HOME/.cargo/env
# rustup default 1.78.0

cd /workspace/bindings/python

free -h
cargo build --jobs 1 --config net.git-fetch-with-cli=true
#cargo build --jobs 1 --config net.git-fetch-with-cli=true

for PYBIN in /opt/python/cp3[891]*/bin; do
for PYBIN in /opt/python/cp310*/bin; do
"${PYBIN}/pip" install maturin
"${PYBIN}/maturin" build -F python -i "${PYBIN}/python" --release
"${PYBIN}/pip" install wheel
"${PYBIN}/maturin" build -i "${PYBIN}/python" --release --out /workspace/bindings/python/dist --compatibility manylinux_2_34
done

for wheel in target/wheels/*.whl; do
auditwheel repair "${wheel}"
done
#/workspace/.github/workflows/patch-wheel-lib-linux.sh /workspace/bindings/python/dist manylinux_2_28

# for wheel in /workspace/bindings/python/dist/*.whl; do
# auditwheel repair "${wheel}"
# done
18 changes: 0 additions & 18 deletions .github/workflows/install-graalvm-linux.sh

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/install-graalvm-sdkman.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -e -x

# Check for correct number of arguments
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <graalvm-sdkman-version>"
echo " example: $0 22.0.1-graalce"
exit 1
fi

# Get the architecture from the input argument
jdk_version=$1

uname -a
yum install -y zip

curl -s "https://get.sdkman.io" | sh -s -- -y
source "root/.sdkman/bin/sdkman-init.sh"

sdk install java $jdk_version
sdk default java $jdk_version
#sdk default java 22.0.1-graalce

echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
4 changes: 2 additions & 2 deletions .github/workflows/install-graalvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ install_graalvm() {

if [ "$dist" == "graalvm" ]; then
download_url="https://download.oracle.com/graalvm/${jdk_version}/latest/graalvm-jdk-${jdk_version}_linux-${jdk_arch}_bin.tar.gz"
elif [ "$dist" == "graalvm-ce" ]; then
elif [ "$dist" == "graalvmce" ]; then
download_url="https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${jdk_version}.0.1/graalvm-community-jdk-${jdk_version}.0.1_linux-${jdk_arch}_bin.tar.gz"
else
echo "Unsupported distribution: $dist"
Expand Down Expand Up @@ -53,7 +53,7 @@ install_graalvm() {

# Check for correct number of arguments
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <x86_64|aarch64> <graalvm|graalvm-ce>"
echo "Usage: $0 <x86_64|aarch64> <graalvm|graalvmce>"
exit 1
fi

Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/release_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,34 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: graalvm/[email protected]
with:
java-version: '22'
distribution: 'graalvm-community'
set-java-home: 'true'
# - name: Graalvm install step
# run: |
# bash .github/workflows/install-graalvm.sh ${{ matrix.platform.target }} graalvm-ce

- name: Graalvm check step
run: |
uname -a
echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
# - uses: graalvm/[email protected]
# with:
# java-version: '22'
# distribution: 'graalvm-community'
# set-java-home: 'true'

# - name: Graalvm check step
# run: |
# uname -a
# echo "GRAALVM_HOME: $GRAALVM_HOME"
# echo "JAVA_HOME: $JAVA_HOME"
# java --version
# native-image --version

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
command: build
args: --manifest-path bindings/python/Cargo.toml --release --out bindings/python/dist -i python3.10 --compatibility manylinux_2_34
#args: --manifest-path bindings/python/Cargo.toml --release --out bindings/python/dist -i python3.10
#working-directory: "bindings/python" # dont use
#working-directory: "bindings/python" # dont use working dir with docker fails to reapply permission on target dir
#args: --manifest-path bindings/python/Cargo.toml --release --out bindings/python/dist -i python3.10 --compatibility manylinux_2_34
args: --manifest-path bindings/python/Cargo.toml --release --out bindings/python/dist -i python3.10
sccache: 'false'
target: ${{ matrix.platform.target }}
#manylinux: '2_34'
container: 'off'
manylinux: '2_34'
#before-script-linux: .github/workflows/install-graalvm.sh ${{ matrix.platform.target }} graalvmce
before-script-linux: .github/workflows/install-graalvm-sdkman.sh 22.0.1-graalce
docker-options: "-e JAVA_HOME=/root/.sdkman/candidates/java/22.0.1-graalce -e GRAALVM_HOME=/root/.sdkman/candidates/java/22.0.1-graalce"
#docker-options: "--mount type=bind,source=/opt/hostedtoolcache,target=/opt/hostedtoolcache -e JAVA_HOME -e GRAALVM_HOME"

- name: Patch wheel lib
Expand Down

0 comments on commit f888d9a

Please sign in to comment.