| 
 | 1 | +version: 2.1  | 
 | 2 | + | 
 | 3 | +orbs:  | 
 | 4 | +  # Replace this with your own!  | 
 | 5 | +  commitlint: conventional-changelog/commitlint@<<pipeline.parameters.dev-orb-version>>  | 
 | 6 | +  orb-tools:  circleci/[email protected]  | 
 | 7 | + | 
 | 8 | +  shellcheck:  circleci/[email protected]  | 
 | 9 | + | 
 | 10 | +# Pipeline Parameters  | 
 | 11 | +## These parameters are used internally by orb-tools. Skip to the Jobs section.  | 
 | 12 | +parameters:  | 
 | 13 | +  run-integration-tests:  | 
 | 14 | +    description: An internal flag to prevent integration test from running before a development version has been created.  | 
 | 15 | +    type: boolean  | 
 | 16 | +    default: false  | 
 | 17 | +  dev-orb-version:  | 
 | 18 | +    description: >  | 
 | 19 | +      The development version of the orb to test.  | 
 | 20 | +      This value is automatically adjusted by the "trigger-integration-tests-workflow" job to correspond with the specific version created by the commit and should not be edited.  | 
 | 21 | +      A "dev:alpha" version must exist for the initial pipeline run.  | 
 | 22 | +    type: string  | 
 | 23 | +    default: "dev:alpha"  | 
 | 24 | + | 
 | 25 | +jobs:  | 
 | 26 | +  # Define one or more jobs which will utilize your orb's commands and parameters to validate your changes.  | 
 | 27 | +  integration-test-1:  | 
 | 28 | +    docker:  | 
 | 29 | +      - image: cimg/base:stable  | 
 | 30 | +    steps:  | 
 | 31 | +      - checkout  | 
 | 32 | +      # "greet" is a sample command packaged with this orb config.  | 
 | 33 | +      # This sample integration test will run as long as the greet command exists. Once you remove the greet command you should remove this line.  | 
 | 34 | +      # Push new changes first, before adding new tests to your config.  | 
 | 35 | +      - commitlint/greet  | 
 | 36 | + | 
 | 37 | +workflows:  | 
 | 38 | +  # Prior to producing a development orb (which requires credentials) basic validation, linting, and even unit testing can be performed.  | 
 | 39 | +  # This workflow will run on every commit  | 
 | 40 | +  test-pack:  | 
 | 41 | +    unless: << pipeline.parameters.run-integration-tests >>  | 
 | 42 | +    jobs:  | 
 | 43 | +      - orb-tools/lint # Lint Yaml files  | 
 | 44 | +      - orb-tools/pack # Pack orb source  | 
 | 45 | +      - shellcheck/check:  | 
 | 46 | +          dir: ./src/scripts  | 
 | 47 | +          exclude: SC2148  | 
 | 48 | +      # optional: Run BATS tests against your scripts  | 
 | 49 | +      - bats/run:  | 
 | 50 | +          path: ./src/tests  | 
 | 51 | +      # Publish development version(s) of the orb.  | 
 | 52 | +      - orb-tools/publish-dev:  | 
 | 53 | +          orb-name: conventional-changelog/commitlint  | 
 | 54 | +          context: orb-publishing # A restricted context containing your private publishing credentials. Will only execute if approved by an authorized user.  | 
 | 55 | +          requires:  | 
 | 56 | +            - orb-tools/lint  | 
 | 57 | +            - orb-tools/pack  | 
 | 58 | +            - bats/run  | 
 | 59 | +            - shellcheck/check  | 
 | 60 | +      # Trigger an integration workflow to test the  | 
 | 61 | +      # dev:${CIRCLE_SHA1:0:7} version of your orb  | 
 | 62 | +      - orb-tools/trigger-integration-tests-workflow:  | 
 | 63 | +          name: trigger-integration-dev  | 
 | 64 | +          context: orb-publishing  | 
 | 65 | +          requires:  | 
 | 66 | +            - orb-tools/publish-dev  | 
 | 67 | + | 
 | 68 | +  # This `integration-test_deploy` workflow will only run  | 
 | 69 | +  # when the run-integration-tests pipeline parameter is set to true.  | 
 | 70 | +  # It is meant to be triggered by the "trigger-integration-tests-workflow"  | 
 | 71 | +  # job, and run tests on <your orb>@dev:${CIRCLE_SHA1:0:7}.  | 
 | 72 | +  integration-test_deploy:  | 
 | 73 | +    when: << pipeline.parameters.run-integration-tests >>  | 
 | 74 | +    jobs:  | 
 | 75 | +      # Run any integration tests defined within the `jobs` key.  | 
 | 76 | +      - integration-test-1  | 
 | 77 | +      # Publish a semver version of the orb. relies on  | 
 | 78 | +      # the commit subject containing the text "[semver:patch|minor|major|skip]"  | 
 | 79 | +      # as that will determine whether a patch, minor or major  | 
 | 80 | +      # version will be published or if publishing should  | 
 | 81 | +      # be skipped.  | 
 | 82 | +      # e.g. [semver:patch] will cause a patch version to be published.  | 
 | 83 | +      - orb-tools/dev-promote-prod-from-commit-subject:  | 
 | 84 | +          orb-name: conventional-changelog/commitlint  | 
 | 85 | +          context: orb-publishing  | 
 | 86 | +          add-pr-comment: false  | 
 | 87 | +          fail-if-semver-not-indicated: true  | 
 | 88 | +          publish-version-tag: false  | 
 | 89 | +          requires:  | 
 | 90 | +            - integration-test-1  | 
 | 91 | +          filters:  | 
 | 92 | +            branches:  | 
 | 93 | +              only:  | 
 | 94 | +                - master  | 
 | 95 | +                - main  | 
0 commit comments