Skip to content

Instantly share code, notes, and snippets.

@mmeyer2k
Last active November 3, 2021 21:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmeyer2k/c6718384212abe490c53fa757b73f031 to your computer and use it in GitHub Desktop.
Save mmeyer2k/c6718384212abe490c53fa757b73f031 to your computer and use it in GitHub Desktop.
circle.ci parallelism for phpunit
#!/bin/sh
# circle.ci parallelism appends the subset of files to run in the container
# to the end of the test command. phpunit does not automatically parse files
# appended to the argument like this:
#
# phpunit --some-args 'testSomething1.php' 'testSomething2.php'
#
# this script parses arguments and individually dispatches calls to phpunit
#
# * you may need to modify the path to phpunit
for var in "$@"
do
./vendor/phpunit/phpunit/phpunit "$var"
done
@t202wes
Copy link

t202wes commented Mar 15, 2018

@mmeyer2k

How are you implementing this in your config.yml

@spaceo
Copy link

spaceo commented Dec 13, 2018

@mmeyer2k
Hi, same question as the previous. Do you have a config.yml demo using this script?

@andrewmclagan
Copy link

me also...

@mmeyer2k
Copy link
Author

mmeyer2k commented Nov 3, 2021

@t202wes @spaceo sorry i didn't notice your comments

@andrewmclagan Here is a basic example of usage. Further documentation is here:

https://circleci.com/docs/2.0/parallelism-faster-jobs/

    steps:
      - run:
          name: Run tests
          command: |
            TEST_FILES=$(circleci tests glob "tests/**/*.php" | circleci tests split --split-by=timings)
            sh /path/to/this/file.sh $TEST_FILES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment