Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python/Ruby/Dotnet support to GHA runner image #11

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions Dockerfile.almalinux
shahidhs-ibm marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ ARG RUNNERREPO="https://github.com/actions/runner" RUNNERPATCH SDK ARCH BTOO

RUN dnf update -y -q && \
dnf install -y -q wget git which langpacks-en glibc-all-langpacks sudo

RUN dnf install -y -q dnf-plugins-core && \
dnf config-manager --set-enabled crb

RUN dnf install -y -q dotnet-sdk-${SDK}.0 && \
echo "Using SDK - `dotnet --version`"
Expand Down Expand Up @@ -39,16 +42,17 @@ RUN mkdir -p /opt/runner && \
chown -R almalinux:almalinux /opt/runner && \
su -c "/opt/runner/config.sh --version" almalinux

RUN dnf install -y -q cmake make automake autoconf m4 gcc gcc-c++ libtool epel-release zlib-devel libffi-devel libyaml
RUN dnf install -y -q cmake make automake autoconf m4 gcc gcc-c++ libtool epel-release

COPY build-files/install-python.sh /tmp
COPY build-files/install-ruby.sh /tmp

RUN if [ "${BTOOLS}" -eq 1 ]; then \
chmod +x /tmp/install-python.sh && \
/tmp/install-python.sh && \
chmod +x /tmp/install-ruby.sh && \
/tmp/install-ruby.sh && \
dnf install -y -q java-11-openjdk openssl-devel ruby perl; \
chmod +x /tmp/install-python.sh; \
/tmp/install-python.sh; \
chmod +x /tmp/install-ruby.sh; \
/tmp/install-ruby.sh; \
chown -R almalinux:almalinux /opt/runner; \
fi

Expand Down
11 changes: 6 additions & 5 deletions Dockerfile.ubuntu
shahidhs-ibm marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@ RUN mkdir -p /opt/runner && \
chown -R ubuntu:ubuntu /opt/runner && \
su -c "/opt/runner/config.sh --version" ubuntu

RUN apt-get -qq -y install cmake make automake autoconf m4 gcc-12-base libtool zlib1g-dev libffi-dev libyaml-dev
RUN apt-get -qq -y install cmake make automake autoconf m4 gcc-12-base libtool

COPY build-files/install-python.sh /tmp
COPY build-files/install-ruby.sh /tmp

RUN if [ "${BTOOLS}" -eq 1 ]; then \
chmod +x /tmp/install-python.sh && \
/tmp/install-python.sh && \
chmod +x /tmp/install-ruby.sh && \
/tmp/install-ruby.sh && \
apt-get -qq -y install openjdk-11-jdk libssl-dev ruby perl; \
chmod +x /tmp/install-python.sh; \
/tmp/install-python.sh; \
chmod +x /tmp/install-ruby.sh; \
/tmp/install-ruby.sh; \
chown -R ubuntu:ubuntu /opt/runner; \
fi

Expand Down
3 changes: 0 additions & 3 deletions build-files/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ update_fresh_container() {
if [ $? -ne 0 ]; then
exit 32
fi
if [ ${BTOOLS} -eq 1 ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-get install wget gcc make zlib1g-dev libffi-dev libtool libyaml-dev -y
fi
sudo apt autoclean

echo "Initializing LXD environment"
Expand Down
29 changes: 18 additions & 11 deletions build-files/install-python.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also cater for opensuse? We have in the rest of the system.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a talk with Anup and he said we are not planning to support opensuse for ppc64le at least for the initial release. I have asked him to remove opensuse support as the present code is giving wrong impression to user.
@anup-kodlekere Please create a PR for removing opensuse from the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it a single PR so that we can revisit and revert that to re-instate the opensuse code.

Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#!/bin/bash

if [ -f /etc/os-release ]; then
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
case $ID in
almalinux|centos|rhel)
sudo dnf install -y -q wget make gcc-c++ libtool zlib-devel libffi-devel libyaml-devel;;
ubuntu)
sudo apt-get install -y wget gcc g++ make libtool zlib1g-dev libffi-dev libyaml-dev;;
*) exit 1;;
esac
else
echo "Unknown OS distribution"
exit 1
fi

PYTHON_VERSIONS="3.8.18 3.10.13 3.12.1"
M_ARCH=$(uname -m)

for pyver in ${PYTHON_VERSIONS}
do
Expand All @@ -9,19 +24,11 @@ do
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
tar -xzf Python-${PYTHON_VERSION}.tgz
cd Python-${PYTHON_VERSION}
./configure --prefix=/opt/runner/_work/_tool/Python/${PYTHON_VERSION}/ppc64le --enable-shared --enable-optimizations --enable-ipv6 LDFLAGS=-Wl,-rpath=/opt/runner/_work/_tool/Python/${PYTHON_VERSION}/ppc64le/lib,--disable-new-dtags
./configure --prefix=/opt/runner/_work/_tool/Python/${PYTHON_VERSION}/${M_ARCH} --enable-shared --enable-optimizations --enable-ipv6 LDFLAGS=-Wl,-rpath=/opt/runner/_work/_tool/Python/${PYTHON_VERSION}/${M_ARCH}/lib,--disable-new-dtags
make -j$(nproc)
sudo make install
sudo touch /opt/runner/_work/_tool/Python/${PYTHON_VERSION}/ppc64le.complete
sudo ln -s /opt/runner/_work/_tool/Python/${PYTHON_VERSION}/ppc64le/bin/python${PYTHON_MAJOR} /opt/runner/_work/_tool/Python/${PYTHON_VERSION}/ppc64le/bin/python
sudo touch /opt/runner/_work/_tool/Python/${PYTHON_VERSION}/${M_ARCH}.complete
sudo ln -s /opt/runner/_work/_tool/Python/${PYTHON_VERSION}/${M_ARCH}/bin/python${PYTHON_MAJOR} /opt/runner/_work/_tool/Python/${PYTHON_VERSION}/${M_ARCH}/bin/python
cd ..
rm -rf Python-${PYTHON_VERSION} Python-${PYTHON_VERSION}.tgz
done








24 changes: 20 additions & 4 deletions build-files/install-ruby.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
#!/bin/bash

sudo apt-get install -y gcc g++ make zlib1g-dev libffi-dev libtool libyaml-dev libssl-dev openjdk-11-jdk ruby
if [ -f /etc/os-release ]; then
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
case $ID in
almalinux|centos|rhel)
sudo dnf install -y -q wget make gcc-c++ libtool zlib-devel libffi-devel libyaml-devel openssl-devel java-11-openjdk ruby rubygem-rake perl;;
ubuntu)
sudo apt-get install -y wget gcc g++ make libtool zlib1g-dev libffi-dev libyaml-dev libssl-dev openjdk-11-jdk ruby;;
*) exit 0;;
esac
else
echo "Unknown OS distribution"
exit 0
fi

M_ARCH=$(uname -m)
if [ "${M_ARCH}" = "ppc64le" ]; then
M_ARCH=ppc64
fi

wget -O /tmp/ruby-build-v20240119.tar.gz https://github.com/rbenv/ruby-build/archive/refs/tags/v20240119.tar.gz
cd /tmp
Expand All @@ -9,11 +26,10 @@ sudo PREFIX=/usr/local ./ruby-build-*/install.sh

ruby-build --list| while IFS= read -r line; do
if [[ "$line" != *"picoruby"* ]] && [[ "$line" != *"truffleruby"* ]]; then
ruby-build $line /opt/runner/_work/_tool/Ruby/$line/ppc64
touch /opt/runner/_work/_tool/Ruby/$line/ppc64.complete
ruby-build $line /opt/runner/_work/_tool/Ruby/$line/${M_ARCH}
touch /opt/runner/_work/_tool/Ruby/$line/${M_ARCH}.complete
echo "Installed $line";
fi
done

rm -rf /tmp/ruby-build-v20240119.tar.gz ./ruby-build-*

Loading