Skip to content

CircleCI compatibility #20

@per1234

Description

@per1234

CircleCI seems to be the primary alternative to Travis CI. It appears their build system is actually much better suited for Arduino projects which require longer build times since the Arduino IDE does not need to be repeatedly downloaded and installed (which represents a significant part of the build duration).

Environment variables

The script has been written to use Travis CI specific environment variables. CircleCI's equivalents (https://circleci.com/docs/1.0/environment-variables/) also need to be supported:

  • Switch according to whether:
  • CIRCLECI is defined as true.
  • TRAVIS is defined as true
  • I should try to set this up in a way that is conducive to use in any build environment (including local use) rather than being locked into a couple specific CI services.
  • TRAVIS_BUILD_NUMBER
    • CIRCLE_BUILD_NUM
  • TRAVIS_JOB_NUMBER
    • CIRCLE_NODE_INDEX
  • TRAVIS_REPO_SLUG
    • Should be able to get this from git?
    • CIRCLE_PROJECT_USERNAME
    • CIRCLE_PROJECT_REPONAME
  • TRAVIS_BUILD_DIR
    • HOME? (this is /home/ubuntu)
    • I should be able to just set this, or maybe $PWD at the start of the build?
  • TRAVIS_JOB_ID (this is used to generate the link to the job log)
    • CIRCLE_BUILD_URL
  • TRAVIS_EVENT_TYPE
    • CIRCLE_PR_NUMBER - can be used to determine if trigger was PR?
    • CIRCLE_TAG - can be used to determien if trigger was tag?
    • Otherwise it was a commit?
  • TRAVIS_ALLOW_FAILURE
    • There is no standard environment variable. I actually don't know if CircleCI has this feature, maybe it's the "experimental" configuration section?
  • TRAVIS_PULL_REQUEST
    • CIRCLE_PR_NUMBER
  • TRAVIS_BRANCH
    • Should be able to get this from git
    • CIRCLE_BRANCH
  • TRAVIS_COMMIT
    • should be able to get this from git
    • CIRCLE_SHA1
  • TRAVIS_COMMIT_RANGE
    • there's no equivalent and I don't think I can determine this.
  • TRAVIS_COMMIT_MESSAGE
    • Should be able to get this from git
  • TRAVIS_TEST_RESULT
    • I could code the script to set this. The only problem is that there might be additional tests in the CI config file that don't use functions of the script
    • Also, CircleCI runs every test in a separate environment so actually I don't think I have any way of sharing data between them
      • Can I store stuff in the artifacts folder (CIRCLE_ARTIFACTS) and then access them from the later builds?

Build system differences

  • Apparently every line of the test is run in a separate environment so I can't share information between them using environment variables.
    • Can I put the information I would usually share by setting global environment variables in the build artifacts folder and then read it back?
      • The build report is already saved as a file.
    • I have a lot of read-only environment variables set at the top of the script
      • I can set global environment variables in one part of the config but I don't think I can download and run the script from there.
      • I could put them in a function and then call that function at the start of every function.

Test script

  • Run a complete CircleCI test of arduino-ci-script
    • Changes required for the arduino-ci-script test build:
      • Create new ci-reports branch for arduino-ci-script CircleCI reports.
      • Create new gist for arduino-ci-script CircleCI reports.
      • I use TRAVIS_REPO_SLUG in .travis.yml.
      • I haven't figured out how to translate the matrix section from my .travis.yml into circle.yml.
        • I don't currently use the matrix for breaking the build into jobs that don't exceed the max duration (though I need to do so).
          • I haven't figured out what the time limit is, if any.
        • CircleCI has some parallelism thing but I haven't figured out how I could use that.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions