Skip to content

Commit

Permalink
Modernise ruby builder
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgodbolt committed Jul 3, 2024
1 parent 4befdc3 commit b31e091
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -ex

ROOT=$PWD
VERSION=$1

URL=https://github.com/ruby/ruby.git
Expand All @@ -27,30 +26,21 @@ if [[ ! -z "${TAG}" ]]; then
REF=refs/tags/${TAG}
fi

FULLNAME=ruby-${VERSION}
OUTPUT=$2/${FULLNAME}.tar.xz

# determine build revision
REVISION=$(git ls-remote "${URL}" "${REF}" | cut -f 1)
LAST_REVISION="${3}"

echo "ce-build-revision:${REVISION}"
echo "ce-build-output:${OUTPUT}"

if [[ "${REVISION}" == "${LAST_REVISION}" ]]; then
echo "ce-build-status:SKIPPED"
exit
fi

FULLNAME=ruby-${VERSION}
OUTPUT=${ROOT}/${FULLNAME}.tar.xz
S3OUTPUT=
if [[ $2 =~ ^s3:// ]]; then
S3OUTPUT=$2
else
if [[ -d "${2}" ]]; then
OUTPUT=$2/${FULLNAME}.tar.xz
else
OUTPUT=${2-$OUTPUT}
fi
fi

BUILD_DIR=${ROOT}/build
STAGING_DIR=/opt/compiler-explorer/${FULLNAME}
rm -rf "${STAGING_DIR}"
Expand Down Expand Up @@ -84,6 +74,4 @@ make install
export XZ_DEFAULTS="-T 0"
tar Jcf ${OUTPUT} --transform "s,^./,./${FULLNAME}/," -C ${STAGING_DIR} .

if [[ ! -z "${S3OUTPUT}" ]]; then
aws s3 cp --storage-class REDUCED_REDUNDANCY "${OUTPUT}" "${S3OUTPUT}"
fi
echo "ce-build-status:OK"

0 comments on commit b31e091

Please sign in to comment.