Skip to content

Commit

Permalink
parallelism
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiewebb committed Jan 14, 2020
1 parent 56bf4a7 commit 5a0cd12
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
29 changes: 26 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,22 @@ workflows:
branches:
ignore:
- master
- test:
- publish_dev:
requires:
- validate
filters:
branches:
only:
- staging
- trying
- test:
requires:
- publish_dev
filters:
branches:
only:
- staging
- trying
- publish:
requires:
- test
Expand All @@ -39,7 +47,7 @@ jobs:
- checkout
- install-circleci
- pack-and-validate
test:
publish_dev:
docker:
- image: cimg/base:2019.08
working_directory: ~/repo
Expand All @@ -56,11 +64,24 @@ jobs:
echo "export ORB_VERSION=\"${ORB_VERSION}\"" >> $BASH_ENV
echo $ORB_VERSION
echo "export PR_MESSAGE=\"BotComment: *Development* version of orb available for manual validation - \\\`${ORB_VERSION}\\\`\"" >> $BASH_ENV
test:
docker:
- image: cimg/base:2019.08
working_directory: ~/repo
parallelism: 4
steps:
- checkout
- install-circleci
- pack-and-validate
- pr-info
- install-bats
- run:
name: Import Tests using BATS
command: |
export BATS_IMPORT_DEV_ORB="eddiewebb/<<pipeline.parameters.orbname>>@dev:${PR_NUMBER}"
export BATS_TEST_LIST=$(bats -l test | cirleci split)
echo "This node will run ${BATS_TEST_LIST}"
bats test
- pr-comment

Expand Down Expand Up @@ -101,7 +122,9 @@ commands:
- run:
name: Install BATS (bash testing)
command: |
cd /tmp && git clone https://github.com/bats-core/bats-core.git && cd bats-core
# my fork includes tets list for splitting
cd /tmp && git clone https://github.com/eddiewebb/bats-core.git && cd bats-core
cp
./install.sh /usr/local
- run:
name: Install YQ
Expand Down
1 change: 1 addition & 0 deletions src/jobs/block_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ resource_class: small
steps:
- until_front_of_line:
consider-branch: <<parameters.consider-branch>>
block-workflow: <<parameters.block-workflow>>
time: <<parameters.time>>
dont-quit: <<parameters.dont-quit>>
only-on-branch: <<parameters.only-on-branch>>
Expand Down
24 changes: 24 additions & 0 deletions test/test_expansion.bats
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,30 @@ function setup {
}



@test "Default job sets block workflow properly" {
# given
process_config_with test/inputs/fulljob.yml

# when
assert_jq_match '.jobs | length' 1 #only 1 job
assert_jq_match '.jobs["Single File"].steps | length' 1 #only 1 steps

jq -r '.jobs["Single File"].steps[0].run.command' $JSON_PROJECT_CONFIG > ${BATS_TMPDIR}/script-${BATS_TEST_NUMBER}.bash

export CIRCLECI_API_KEY="madethisup"
export CIRCLE_BUILD_NUM="2"
export CIRCLE_JOB="singlejob"
export CIRCLE_PROJECT_USERNAME="madethisup"
export CIRCLE_PROJECT_REPONAME="madethisup"
export CIRCLE_REPOSITORY_URL="madethisup"
export CIRCLE_BRANCH="madethisup"

run bash ${BATS_TMPDIR}/script-${BATS_TEST_NUMBER}.bash
assert_contains_text "Orb parameter block-workflow is true."
}


# See https://github.com/eddiewebb/circleci-queue/issues/26 for explanation of race condition
@test "Race condition on previous workflow does not fool us" {
# given
Expand Down

0 comments on commit 5a0cd12

Please sign in to comment.