ci: add checks to determine if build is required (#112)

also save build info upon successful build
This commit is contained in:
dman776 2018-08-05 11:23:33 -05:00 committed by GitHub
parent 48c3edf729
commit 96cdb42616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 6 deletions

View File

@ -12,10 +12,8 @@ jobs:
name: Update Config.mk
command: |
export MY_WORKING_DIRECTORY=`pwd`
ls -la
sed -i "s/NoCall/${CIRCLE_BUILD_NUM}/g" ${MY_WORKING_DIRECTORY}/config.mk
cat ${MY_WORKING_DIRECTORY}/config.mk
set
- run:
name: Build
command: make
@ -29,6 +27,21 @@ jobs:
name: Deploy Files
command: scp -o StrictHostKeyChecking=no ~/${CIRCLE_BRANCH}_${ARTIFACTS_FILE} ${SSH_USER}@${SSH_HOST}:~/
needs_to_be_built:
machine:
enabled: true
steps:
- run:
name: Retrieve last build info and check
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c ' ~/needs2build.sh ${CIRCLE_PROJECT_USERNAME} ${CIRCLE_PROJECT_REPONAME} ${CIRCLE_BRANCH} ${CIRCLE_SHA1}'"
save_build_info:
machine:
enabled: true
steps:
- run:
name: Save last build info
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c ' echo ${CIRCLE_SHA1} > ~/build_info/${CIRCLE_PROJECT_USERNAME}_${CIRCLE_PROJECT_REPONAME}_${CIRCLE_BRANCH}'"
######################################
# Nightly
######################################
@ -39,9 +52,6 @@ jobs:
- run:
name: Untar Files
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'tar -xjf ~/${CIRCLE_BRANCH}_${ARTIFACTS_FILE} -C ~/'"
#- run:
# name: Remove tarball
# command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'rm ~/${CIRCLE_BRANCH}_${ARTIFACTS_FILE}'"
- run:
name: Empty nightly dir
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'rm -rf ${NIGHTLY_DIR}'"
@ -91,7 +101,12 @@ workflows:
branches:
only: develop
jobs:
- build
- build:
requires:
- needs_to_be_built
- save_build_info:
requires:
- build
- process_artifacts_nightly:
requires:
- build