Skip to content

Commit

Permalink
ci: install graalvm script
Browse files Browse the repository at this point in the history
  • Loading branch information
nmammeri committed Jul 4, 2024
1 parent 8d48c11 commit 43a76d1
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 14 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/install-graalvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
set -e -x

# Function to download and install GraalVM
install_graalvm() {
local arch=$1
local dist=$2

local jdk_version="22"
local jdk_arch=""
local download_url=""
local graalvm_install_dir="/opt/hostedtoolcache"

if [ "$arch" == "x86_64" ]; then
jdk_arch="x64"
elif [ "$arch" == "aarch64" ]; then
jdk_arch="aarch64"
else
echo "Unsupported architecture: $arch"
exit 1
fi

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
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"
exit 1
fi


# Create installation directory
rm -rf "$graalvm_install_dir" 2>/dev/null
mkdir -p $graalvm_install_dir

# Download and extract GraalVM
echo "Downloading GraalVM from $download_url"
curl -L $download_url | tar -xz -C $graalvm_install_dir

# Get the single directory name within the base path
local graalvm_home=$(find "$graalvm_install_dir" -mindepth 1 -maxdepth 1 -type d | head -n 1)

echo "GraalVM $graalvm_version installed successfully in $graalvm_home"

# persist the var across step of github workflow
export JAVA_HOME=$graalvm_home
export GRAALVM_HOME=$graalvm_home
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo "GRAALVM_HOME=$GRAALVM_HOME" >> $GITHUB_ENV

}

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

# Get the architecture from the input argument
target_arch=$1
target_dist=$2

# Call the installation function
install_graalvm $target_arch $target_dist
25 changes: 11 additions & 14 deletions .github/workflows/release_pyton_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,19 @@ jobs:
platform:
- runner: ubuntu-latest
target: x86_64
# - runner: ubuntu-latest
# target: aarch64
#container: quay.io/pypa/manylinux_2_28_${{ matrix.platform.target }}
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v4

- uses: graalvm/[email protected]
with:
java-version: '22'
distribution: 'graalvm-community'
set-java-home: 'true'
# - name: Graalvm install step
# run: |
# uname -a
# echo "GRAALVM_HOME: $GRAALVM_HOME"
# echo "JAVA_HOME: $JAVA_HOME"
# - 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
- name: Graalvm check step
run: |
Expand Down Expand Up @@ -69,7 +66,7 @@ jobs:
shell: bash
run: |
set -e
pip install extract-rs --find-links dist --force-reinstall
pip install extract-rs --find-links bindings/python/dist --force-reinstall
pip install pytest
pytest
Expand Down

0 comments on commit 43a76d1

Please sign in to comment.