From 8e72d1ba09d40c76b0a6caff2c1226891f7cd519 Mon Sep 17 00:00:00 2001 From: casey langen Date: Sat, 16 Jan 2021 13:41:33 -0800 Subject: [PATCH] Script fixes for building locally with circleci --- .circleci/config.yml | 12 +++++------ script/copy-artifacts-to-host.sh | 15 ++++++++++++- script/run-circle-ci.sh | 37 ++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 7 deletions(-) create mode 100755 script/run-circle-ci.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index bd1916205..de8b7141d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,8 +10,8 @@ jobs: - run: cmake -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=bionic -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . - run: make -j2 - run: make package + - run: ./script/copy-artifacts-to-host.sh /root/project/*.deb - run: mkdir -p /root/debs && mv /root/project/*.deb /root/debs/ - - run: ./script/copy-artifacts-to-host.sh /root/debs - store_artifacts: path: /root/debs/ build_ubuntu_focal: @@ -24,8 +24,8 @@ jobs: - run: cmake -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=focal -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . - run: make -j2 - run: make package + - run: ./script/copy-artifacts-to-host.sh /root/project/*.deb - run: mkdir -p /root/debs && mv /root/project/*.deb /root/debs/ - - run: ./script/copy-artifacts-to-host.sh /root/debs - store_artifacts: path: /root/debs/ build_ubuntu_groovy: @@ -38,8 +38,8 @@ jobs: - run: cmake -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=groovy -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . - run: make -j2 - run: make package + - run: ./script/copy-artifacts-to-host.sh /root/project/*.deb - run: mkdir -p /root/debs && mv /root/project/*.deb /root/debs/ - - run: ./script/copy-artifacts-to-host.sh /root/debs - store_artifacts: path: /root/debs/ build_fedora_31: @@ -51,8 +51,8 @@ jobs: - run: dnf builddep -y musikcube.spec - run: mkdir -p /root/rpmbuild/SOURCES && spectool -g -R musikcube.spec - run: rpmbuild -ba -vv musikcube.spec + - run: ./script/copy-artifacts-to-host.sh /root/rpmbuild/RPMS/x86_64/*.rpm - run: mkdir -p /root/rpms && mv /root/rpmbuild/RPMS/x86_64/*.rpm /root/rpms/ - - run: ./script/copy-artifacts-to-host.sh /root/rpms - store_artifacts: path: /root/rpms/ build_fedora_32: @@ -64,8 +64,8 @@ jobs: - run: dnf builddep -y musikcube.spec - run: mkdir -p /root/rpmbuild/SOURCES && spectool -g -R musikcube.spec - run: rpmbuild -ba -vv musikcube.spec + - run: ./script/copy-artifacts-to-host.sh /root/rpmbuild/RPMS/x86_64/*.rpm - run: mkdir -p /root/rpms && mv /root/rpmbuild/RPMS/x86_64/*.rpm /root/rpms/ - - run: ./script/copy-artifacts-to-host.sh /root/rpms - store_artifacts: path: /root/rpms/ build_fedora_33: @@ -77,8 +77,8 @@ jobs: - run: dnf builddep -y musikcube.spec - run: mkdir -p /root/rpmbuild/SOURCES && spectool -g -R musikcube.spec - run: rpmbuild -ba -vv musikcube.spec + - run: ./script/copy-artifacts-to-host.sh /root/rpmbuild/RPMS/x86_64/*.rpm - run: mkdir -p /root/rpms && mv /root/rpmbuild/RPMS/x86_64/*.rpm /root/rpms/ - - run: ./script/copy-artifacts-to-host.sh /root/rpms - store_artifacts: path: /root/rpms/ workflow_filters: &workflow_filters diff --git a/script/copy-artifacts-to-host.sh b/script/copy-artifacts-to-host.sh index 7065ac789..437f6b65c 100755 --- a/script/copy-artifacts-to-host.sh +++ b/script/copy-artifacts-to-host.sh @@ -1,11 +1,24 @@ #!/bin/bash if [[ -z "${MUSIKCUBE_BUILD_HOST_IP}" ]]; then + echo "no build host ip specified" exit fi if [[ -z "${MUSIKCUBE_BUILD_HOST_PW}" ]]; then + echo "no build host pw specified" exit fi -sshpass -p ${MUSIKCUBE_BUILD_HOST_PW} scp "$1/*" build@${MUSIKCUBE_BUILD_HOST_IP}:/home/build/ 2> /dev/null +GLOB=${1} + +if [[ -z "${GLOB}" ]]; then + echo "no file glob specified." + exit +fi + +echo "copying build artifacts to host..." +echo " from: ${GLOB}" +ls -al "${GLOB}" +sshpass -p ${MUSIKCUBE_BUILD_HOST_PW} scp -o StrictHostKeyChecking=no "${GLOB}" build@${MUSIKCUBE_BUILD_HOST_IP}:/home/build/ 2> /dev/null +echo "finished copying build artifacts." diff --git a/script/run-circle-ci.sh b/script/run-circle-ci.sh new file mode 100755 index 000000000..11891bdc6 --- /dev/null +++ b/script/run-circle-ci.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +IP=$1 +PW=$2 + +if [[ -z "${IP}" ]]; then + echo "no file ip address specified." + exit +fi + +if [[ -z "${PW}" ]]; then + echo "no scp password address specified." + exit +fi + +ALL_JOBS=( + "build_ubuntu_bionic" + "build_ubuntu_focal" + "build_ubuntu_groovy" + "build_fedora_33" + "build_fedora_32" + "build_fedora_31" +) + +BRANCH="clangen/local-circle-ci" +REPO="https://github.com/clangen/musikcube" + +for JOB in ${ALL_JOBS[@]}; do + circleci local execute \ + -c .circleci/config.yml \ + -e CIRCLE_BRANCH=${BRANCH} \ + -e CIRCLE_REPOSITORY_URL=${REPO} \ + -e MUSIKCUBE_BUILD_HOST_IP=${IP} \ + -e MUSIKCUBE_BUILD_HOST_PW=${PW} \ + --job ${JOB} +done +