Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Add Homebrew package test steps to CICD. #10555

Merged
merged 10 commits into from
Jul 22, 2021
37 changes: 33 additions & 4 deletions .cicd/generate-pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ EOF
- label: ":centos: CentOS 7 - Test Package"
command:
- "buildkite-agent artifact download '*.rpm' . --step ':centos: CentOS 7.7 - Package Builder' --agent-access-token \$\$BUILDKITE_AGENT_ACCESS_TOKEN"
- "./.cicd/test-package.sh"
- "./.cicd/test-package.docker.sh"
env:
IMAGE: "centos:7"
agents:
Expand All @@ -585,7 +585,7 @@ EOF
- label: ":aws: Amazon Linux 2 - Test Package"
command:
- "buildkite-agent artifact download '*.rpm' . --step ':centos: CentOS 7.7 - Package Builder' --agent-access-token \$\$BUILDKITE_AGENT_ACCESS_TOKEN"
- "./.cicd/test-package.sh"
- "./.cicd/test-package.docker.sh"
env:
IMAGE: "amazonlinux:2"
agents:
Expand Down Expand Up @@ -613,7 +613,7 @@ EOF
- label: ":ubuntu: Ubuntu 16.04 - Test Package"
command:
- "buildkite-agent artifact download '*.deb' . --step ':ubuntu: Ubuntu 16.04 - Package Builder' --agent-access-token \$\$BUILDKITE_AGENT_ACCESS_TOKEN"
- "./.cicd/test-package.sh"
- "./.cicd/test-package.docker.sh"
env:
IMAGE: "ubuntu:16.04"
agents:
Expand Down Expand Up @@ -641,7 +641,7 @@ EOF
- label: ":ubuntu: Ubuntu 18.04 - Test Package"
command:
- "buildkite-agent artifact download '*.deb' . --step ':ubuntu: Ubuntu 18.04 - Package Builder' --agent-access-token \$\$BUILDKITE_AGENT_ACCESS_TOKEN"
- "./.cicd/test-package.sh"
- "./.cicd/test-package.docker.sh"
env:
IMAGE: "ubuntu:18.04"
agents:
Expand Down Expand Up @@ -674,9 +674,38 @@ EOF
cd: ~
agents:
- "queue=mac-anka-node-fleet"
key: "macos1014pb"
timeout: ${TIMEOUT:-30}
skip: ${SKIP_MACOS_10_14}${SKIP_PACKAGE_BUILDER}${SKIP_MAC}

- label: ":darwin: macOS 10.14 - Test Package"
command:
- "git clone \$BUILDKITE_REPO eos && cd eos && $GIT_FETCH git checkout -f \$BUILDKITE_COMMIT"
- "cd eos && buildkite-agent artifact download '*' . --step ':darwin: macOS 10.14 - Package Builder' --agent-access-token \$\$BUILDKITE_AGENT_ACCESS_TOKEN"
- "cd eos && ./.cicd/test-package.anka.sh"
plugins:
- EOSIO/anka#v0.6.1:
no-volume: true
inherit-environment-vars: true
vm-name: 10.14.6_6C_14G_80G
vm-registry-tag: "clean::cicd::git-ssh::nas::brew::buildkite-agent"
always-pull: true
debug: true
wait-network: true
pre-execute-sleep: 5
pre-execute-ping-sleep: github.com
failover-registries:
- 'registry_1'
- 'registry_2'
- EOSIO/skip-checkout#v0.1.1:
cd: ~
agents:
- "queue=mac-anka-node-fleet"
depends_on: "macos1014pb"
allow_dependency_failure: false
timeout: ${TIMEOUT:-10}
skip: ${SKIP_MACOS_10_14}${SKIP_PACKAGE_BUILDER}${SKIP_MAC}

- label: ":docker: Docker - Label Container with Git Branch and Git Tag"
command: .cicd/docker-tag.sh
env:
Expand Down
6 changes: 6 additions & 0 deletions .cicd/libfunctions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

function perform {
echo "$ $1"
eval $1
}
13 changes: 13 additions & 0 deletions .cicd/test-package.anka.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail

. "${0%/*}/libfunctions.sh"

echo '--- :anka: Pretest Setup'

if [[ ! $(python3 --version 2>/dev/null) ]]; then
perform 'brew update'
perform 'brew install python3'
fi

perform "./.cicd/test-package.run.sh"
9 changes: 9 additions & 0 deletions .cicd/test-package.docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail

. "${0%/*}/libfunctions.sh"

echo '--- :docker: Pretest Setup'

perform "docker pull $IMAGE"
perform "docker run --rm -v \"\$(pwd):/eos\" -w '/eos' -it $IMAGE ./.cicd/test-package.run.sh"
36 changes: 21 additions & 15 deletions .cicd/test-package.run.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
#!/bin/bash
set -eu
set -euo pipefail

. "${0%/*}/libfunctions.sh"

echo '+++ :minidisc: Installing EOSIO'

if [[ $(apt-get --version 2>/dev/null) ]]; then # debian family
UPDATE='apt-get update'
echo "$ $UPDATE"
eval $UPDATE
INSTALL="apt-get install -y /eos/*.deb"
echo "$ $INSTALL"
eval $INSTALL
elif [[ $(yum --version 2>/dev/null) ]]; then # RHEL family
UPDATE='yum check-update || :'
echo "$ $UPDATE"
eval $UPDATE
INSTALL="yum install -y /eos/*.rpm"
echo "$ $INSTALL"
eval $INSTALL
if [[ $(apt-get --version 2>/dev/null) ]]; then # debian family packaging
perform 'apt-get update'
perform 'apt-get install -y /eos/*.deb'
elif [[ $(yum --version 2>/dev/null) ]]; then # RHEL family packaging
perform 'yum check-update || :'
perform 'yum install -y /eos/*.rpm'
elif [[ $(brew --version 2>/dev/null) ]]; then # homebrew packaging
perform 'brew update'
perform 'mkdir homebrew-eosio'
perform 'git init homebrew-eosio'
perform 'cp *.rb homebrew-eosio'
perform "sed -i.bk -e 's/url \".*\"/url \"http:\/\/127.0.0.1:7800\"/' homebrew-eosio/*.rb"
perform "pushd homebrew-eosio && git add *.rb && git commit -m 'test it!' && popd"
perform "brew tap eosio/eosio homebrew-eosio"
perform '{ python3 -m http.server 7800 & } && export HTTP_SERVER_PID=$!'
perform 'sleep 20s'
perform 'brew install eosio'
perform 'kill $HTTP_SERVER_PID'
else
echo 'ERROR: Package manager not detected!'
exit 3
Expand Down
7 changes: 0 additions & 7 deletions .cicd/test-package.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/generate_bottle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ echo "class Eosio < Formula
depends_on \"gettext\"
depends_on \"openssl@1.1\"
depends_on \"libusb\"
depends_on macos: mojave
depends_on macos: :mojave
depends_on arch: :intel

bottle do
Expand Down