Skip to content

Circle CI

Lam Ngoc Khuong edited this page Nov 16, 2023 · 8 revisions

Configure for the single module

  • Module: kotlin-web-spring-boot-3
  • JDK: 17.0.9

.circleci/config.yml:

version: 2.1
orbs:
  gradle: circleci/[email protected]

executors:
  custom-executor:
    docker:
      - image: cimg/openjdk:<<parameters.tag>>
    parameters:
      tag:
        type: string
        default: "17.0"

workflows:
  checkout-build-test:
    jobs:
      - gradle/test:
          app_src_directory: kotlin-web-spring-boot-3/
          reports_path: build/reports/
          test_results_path: build/test-results/
          executor:
            name: "custom-executor"
            tag: "17.0.9"

Configure for a Monorepo (a single repository for multiple modules)

.circleci/config.yml:

version: 2.1
# this allows you to use CircleCI's dynamic configuration feature
setup: true

# the path-filtering orb is required to continue a pipeline based on
# the path of an updated fileset
orbs:
  path-filtering: circleci/[email protected]

workflows:
  setup:
    jobs:
      # the path-filtering/filter job determines which pipeline
      # parameters to update.
      - path-filtering/filter:
          name: check-updated-files
          # 3-column, whitespace-delimited mapping. One mapping per
          # line:
          # <regex path-to-test> <parameter-to-set> <value-of-pipeline-parameter>
          mapping: |
            kotlin-web-spring-boot-3/.* run-kotlin-web-spring-boot-3-workflow true
            kotlin-web-spring-boot-3-auth/.* run-kotlin-web-spring-boot-3-auth-workflow true
            kotlin-webmvc-spring-boot-3/.* run-kotlin-webmvc-spring-boot-3-workflow true
          base-revision: main
          # this is the path of the configuration we should trigger once
          # path filtering and pipeline parameter value updates are
          # complete. In this case, we are using the parent dynamic
          # configuration itself.
          config-path: .circleci/workflows.yml

.circleci/workflows.yml:

version: 2.1
orbs:
  gradle: circleci/[email protected]

# the default pipeline parameters, which will be updated according to
# the results of the path-filtering orb
parameters:
  run-kotlin-web-spring-boot-3-workflow:
    type: boolean
    default: false
  run-kotlin-web-spring-boot-3-auth-workflow:
    type: boolean
    default: false

executors:
  custom-executor:
    docker:
      - image: cimg/openjdk:<<parameters.tag>>
    parameters:
      tag:
        type: string
        default: "17.0"

# here we specify our workflows, most of which are conditionally
# executed based upon pipeline parameter values. Each workflow calls a
# specific job defined above, in the jobs section.
workflows:
  # when pipeline parameter, run-kotlin-web-spring-boot-3-workflow is true, the
  # kotlin-web-spring-boot-3 workflow is triggered.
  kotlin-web-spring-boot-3:
    when: << pipeline.parameters.run-kotlin-web-spring-boot-3-workflow >>
    jobs:
      - gradle/test:
          app_src_directory: kotlin-web-spring-boot-3/
          reports_path: build/reports/
          test_results_path: build/test-results/
          executor:
            name: "custom-executor"
            tag: "17.0.9"
  kotlin-web-spring-boot-3-auth:
    when: << pipeline.parameters.run-kotlin-web-spring-boot-3-auth-workflow >>
    jobs:
      - gradle/test:
          app_src_directory: kotlin-web-spring-boot-3-auth/
          reports_path: build/reports/
          test_results_path: build/test-results/
          executor:
            name: "custom-executor"
            tag: "17.0.9"
  kotlin-webmvc-spring-boot-3:
    when: << pipeline.parameters.run-kotlin-webmvc-spring-boot-3-workflow >>
    jobs:
      - gradle/test:
          app_src_directory: kotlin-webmvc-spring-boot-3/
          reports_path: build/reports/
          test_results_path: build/test-results/
          executor:
            name: "custom-executor"
            tag: "17.0.9"

Refer to:

Common References

Pages

Home

Projects

Help

Development Process

Working with Git branches

Clone this wiki locally