This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from EOSIO/1.9.x-to-main
1.9.x to main
- Loading branch information
Showing
55 changed files
with
4,315 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
. ./.cicd/helpers/buildkite.sh | ||
. ./.cicd/helpers/general.sh | ||
. ./.cicd/helpers/dependency-info.sh | ||
mkdir -p $BUILD_DIR | ||
DOCKER_IMAGE=${DOCKER_IMAGE:-eosio/ci-contracts-builder:base-ubuntu-18.04-$SANITIZED_EOSIO_VERSION} | ||
if [[ "$BUILDKITE" == 'true' ]]; then | ||
buildkite-agent meta-data set cdt-url "$CDT_URL" | ||
buildkite-agent meta-data set cdt-version "$CDT_VERSION" | ||
buildkite-agent meta-data set docker-image "$DOCKER_IMAGE" | ||
else | ||
export CDT_URL | ||
export CDT_VERSION | ||
export DOCKER_IMAGE | ||
fi | ||
ARGS=${ARGS:-"--rm -v $(pwd):$MOUNTED_DIR"} | ||
CDT_COMMANDS="dpkg -i $MOUNTED_DIR/eosio.cdt.deb && export PATH=/usr/opt/eosio.cdt/\\\$(ls /usr/opt/eosio.cdt/)/bin:\\\$PATH" | ||
PRE_COMMANDS="$CDT_COMMANDS && cd /root/eosio/ && printf \\\"EOSIO commit: \\\$(git rev-parse --verify HEAD). Click \033]1339;url=https://github.com/EOSIO/eos/commit/\\\$(git rev-parse --verify HEAD);content=here\a for details.\n\\\" && cd $MOUNTED_DIR/build" | ||
BUILD_COMMANDS="cmake -DBUILD_TESTS=true .. && make -j $JOBS" | ||
COMMANDS="$PRE_COMMANDS && $BUILD_COMMANDS" | ||
# Test CDT binary download to prevent failures due to eosio.cdt pipeline. | ||
INDEX='1' | ||
echo "$ curl -sSf $CDT_URL --output eosio.cdt.deb" | ||
while ! $(curl -sSf $CDT_URL --output eosio.cdt.deb); do | ||
echo "ERROR: Expected CDT binary for commit ${CDT_COMMIT} from $CDT_VERSION. It does not exist at $CDT_URL!" | ||
printf "There must be a successful build against ${CDT_COMMIT} \033]1339;url=https://buildkite.com/EOSIO/eosio-dot-cdt/builds?commit=$CDT_COMMIT;content=here\a for this package to exist.\n" | ||
echo "Attempt $INDEX, retry in 60 seconds..." | ||
echo '' | ||
INDEX=$(( $INDEX + 1 )) | ||
sleep 60 | ||
done | ||
# retry docker pull to protect against failures due to race conditions with eosio pipeline | ||
INDEX='1' | ||
echo "$ docker pull $DOCKER_IMAGE" | ||
while [[ "$(docker pull $DOCKER_IMAGE 2>&1 | grep -ice "manifest for $DOCKER_IMAGE not found")" != '0' ]]; do | ||
echo "ERROR: Docker image \"$DOCKER_IMAGE\" not found for eosio \"$EOSIO_VERSION\""'!' | ||
printf "There must be a successful build against ${EOSIO_VERSION} \033]1339;url=${EOSIO_BK_URL};content=here\a for this container to exist.\n" | ||
echo "Attempt $INDEX, retry in 60 seconds..." | ||
echo '' | ||
INDEX=$(( $INDEX + 1 )) | ||
sleep 60 | ||
done | ||
# run | ||
echo "docker run $ARGS $(buildkite-intrinsics) $DOCKER_IMAGE bash -c \"$COMMANDS\"" | ||
eval docker run $ARGS $(buildkite-intrinsics) $DOCKER_IMAGE bash -c \"$COMMANDS\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# load buildkite intrinsic environment variables for use in docker run | ||
function buildkite-intrinsics() | ||
{ | ||
BK_ENV='' | ||
if [[ -f $BUILDKITE_ENV_FILE ]]; then | ||
while read -r var; do | ||
BK_ENV="$BK_ENV --env ${var%%=*}" | ||
done < "$BUILDKITE_ENV_FILE" | ||
fi | ||
echo "$BK_ENV" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
[[ "$RAW_PIPELINE_CONFIG" == '' ]] && export RAW_PIPELINE_CONFIG="$1" | ||
[[ "$RAW_PIPELINE_CONFIG" == '' ]] && export RAW_PIPELINE_CONFIG='pipeline.jsonc' | ||
[[ "$PIPELINE_CONFIG" == '' ]] && export PIPELINE_CONFIG='pipeline.json' | ||
# read dependency file | ||
if [[ -f "$RAW_PIPELINE_CONFIG" ]]; then | ||
echo 'Reading pipeline configuration file...' | ||
cat "$RAW_PIPELINE_CONFIG" | grep -Po '^[^"/]*("((?<=\\).|[^"])*"[^"/]*)*' | jq -c .\"eosio-dot-contracts\" > "$PIPELINE_CONFIG" | ||
CDT_VERSION=$(cat "$PIPELINE_CONFIG" | jq -r '.dependencies."eosio.cdt"') | ||
EOSIO_VERSION=$(cat "$PIPELINE_CONFIG" | jq -r '.dependencies.eosio') | ||
SANITIZED_EOSIO_VERSION=$(echo $EOSIO_VERSION | sed 's/\//\_/') | ||
else | ||
echo 'ERROR: No pipeline configuration file or dependencies file found!' | ||
exit 1 | ||
fi | ||
# search GitHub for commit hash by tag and branch, preferring tag if both match | ||
if [[ "$BUILDKITE" == 'true' ]]; then | ||
CDT_COMMIT=$((curl -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') | ||
EOSIO_COMMIT=$((curl -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') | ||
test -z "$CDT_COMMIT" && CDT_COMMIT=$(echo $CDT_VERSION | tr -d '"' | tr -d "''" | cut -d ' ' -f 1) # if both searches returned nothing, the version is probably specified by commit hash already | ||
test -z "$EOSIO_COMMIT" && EOSIO_COMMIT=$(echo $EOSIO_VERSION | tr -d '"' | tr -d "''" | cut -d ' ' -f 1) # if both searches returned nothing, the version is probably specified by commit hash already | ||
else | ||
git clone https://github.com/EOSIO/eosio.cdt && cd eosio.cdt | ||
git pull && git checkout $CDT_VERSION | ||
CDT_COMMIT=$(git rev-parse --verify HEAD) | ||
cd .. | ||
git clone https://github.com/EOSIO/eos && cd eos | ||
git pull && git checkout $EOSIO_VERSION | ||
EOSIO_COMMIT=$(git rev-parse --verify HEAD) | ||
cd .. | ||
fi | ||
if [[ "$EOSIO_COMMIT" == "$EOSIO_VERSION" ]]; then | ||
EOSIO_BK_URL="https://buildkite.com/EOSIO/eosio/builds?commit=${EOSIO_COMMIT}" | ||
else | ||
EOSIO_BK_URL="https://buildkite.com/EOSIO/eosio/builds?branch=${EOSIO_VERSION}" | ||
fi | ||
echo "Using eosio \"$EOSIO_VERSION\"..." | ||
echo "Using cdt ${CDT_COMMIT} from \"$CDT_VERSION\"..." | ||
export CDT_URL="https://eos-public-oss-binaries.s3-us-west-2.amazonaws.com/${CDT_COMMIT:0:7}-eosio.cdt-ubuntu-18.04_amd64.deb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export ROOT_DIR=$( dirname "${BASH_SOURCE[0]}" )/../.. | ||
export BUILD_DIR=$ROOT_DIR/build | ||
export CICD_DIR=$ROOT_DIR/.cicd | ||
export HELPERS_DIR=$CICD_DIR/helpers | ||
export JOBS=${JOBS:-"$(getconf _NPROCESSORS_ONLN)"} | ||
export MOUNTED_DIR='/workdir' |
Oops, something went wrong.