From 16320a669248db3b758b54168d7934952d10fe58 Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Fri, 11 Oct 2024 22:54:08 +1100 Subject: [PATCH 1/2] Update to tagging workflow Signed-off-by: Karl Hepworth --- .circleci/config.yml | 110 ++++++-------------------------------- .circleci/test-deploy.yml | 38 +++++++++++++ 2 files changed, 54 insertions(+), 94 deletions(-) create mode 100644 .circleci/test-deploy.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index d451f80..f500f8f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,100 +1,22 @@ version: 2.1 - +setup: true orbs: - drupal: pnx/drupal@<> - orb-tools: circleci/orb-tools@10.0 - bats: circleci/bats@1.0 - shellcheck: circleci/shellcheck@2.0 - -# Pipeline Parameters -## These parameters are used internally by orb-tools. Skip to the Jobs section. -parameters: - run-integration-tests: - description: An internal flag to prevent integration test from running before a development version has been created. - type: boolean - default: false - dev-orb-version: - description: > - The development version of the orb to test. - 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. - A "dev:alpha" version must exist for the initial pipeline run. - type: string - default: "dev:alpha" + orb-tools: circleci/orb-tools@12.1 + shellcheck: circleci/shellcheck@3.2 -jobs: - # Define one or more jobs which will utilize your orb's commands and parameters to validate your changes. - integration-test-1: - docker: - - image: cimg/base:stable - steps: - - checkout - # "greet" is a sample command packaged with this orb config. - # This sample integration test will run as long as the greet command exists. Once you remove the greet command you should remove this line. - # Push new changes first, before adding new tests to your config. -# - drupal/greet +filters: &filters + tags: + only: /.*/ workflows: - # Prior to producing a development orb (which requires credentials) basic validation, linting, and even unit testing can be performed. - # This workflow will run on every commit - test-pack: - unless: << pipeline.parameters.run-integration-tests >> - jobs: - - orb-tools/lint # Lint Yaml files - - orb-tools/pack # Pack orb source - - shellcheck/check: - dir: ./src/scripts - exclude: SC2148,SC2086 - # optional: Run BATS tests against your scripts - - bats/run: - path: ./src/tests - # If you accept building open source forks, protect your secrects behind a restricted context. - # A job containing restricted context (which holds your orb publishing credentials) may only be accessed by a user with proper permissions. - # An open source user may begin a pipeline with a PR, and once the pipeline is approved by an authorized user at this point, the pipeline will continue with the proper context permissions. - - hold-for-dev-publish: - type: approval - requires: - - orb-tools/lint - - orb-tools/pack - - bats/run - - shellcheck/check - # Publish development version(s) of the orb. - - orb-tools/publish-dev: - orb-name: pnx/drupal - context: orb-publishing # A restricted context containing your private publishing credentials. Will only execute if approved by an authorized user. - requires: [hold-for-dev-publish] - # Trigger an integration workflow to test the - # dev:${CIRCLE_SHA1:0:7} version of your orb - - orb-tools/trigger-integration-tests-workflow: - name: trigger-integration-dev - context: orb-publishing - requires: - - orb-tools/publish-dev - - # This `integration-test_deploy` workflow will only run - # when the run-integration-tests pipeline parameter is set to true. - # It is meant to be triggered by the "trigger-integration-tests-workflow" - # job, and run tests on @dev:${CIRCLE_SHA1:0:7}. - integration-test_deploy: - when: << pipeline.parameters.run-integration-tests >> + lint-pack: jobs: - # Run any integration tests defined within the `jobs` key. -# - integration-test-1 - # Publish a semver version of the orb. relies on - # the commit subject containing the text "[semver:patch|minor|major|skip]" - # as that will determine whether a patch, minor or major - # version will be published or if publishing should - # be skipped. - # e.g. [semver:patch] will cause a patch version to be published. - - orb-tools/dev-promote-prod-from-commit-subject: - orb-name: pnx/drupal - context: orb-publishing - add-pr-comment: false - fail-if-semver-not-indicated: true - publish-version-tag: false -# requires: -# - integration-test-1 - filters: - branches: - only: - - main - - main + - orb-tools/lint + - orb-tools/lint + - orb-tools/pack + - orb-tools/continue: + pipeline_number: << pipeline.number >> + vcs_type: << pipeline.project.type >> + orb_name: previousnext/drupal + requires: [orb-tools/lint, orb-tools/pack] + filters: *filters \ No newline at end of file diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml new file mode 100644 index 0000000..9c388b7 --- /dev/null +++ b/.circleci/test-deploy.yml @@ -0,0 +1,38 @@ +version: 2.1 +orbs: + orb-tools: circleci/orb-tools@12.1 + drupal: {} + +filters: &filters + tags: + only: /.*/ + +release-filters: &release-filters + branches: + ignore: /.*/ + tags: + only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ + +jobs: + command-test: + docker: + - image: cimg/base:current + steps: + - checkout + +workflows: + test-deploy: + jobs: + - command-test: + filters: *filters + - orb-tools/pack: + filters: *release-filters + - orb-tools/publish: + orb_name: previousnext/drupal + vcs_type: << pipeline.project.type >> + pub_type: production + requires: + - orb-tools/pack + - command-test + context: orb-publishing + filters: *release-filters From 07497cf642566585895ffbe30d369737281da45a Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Fri, 11 Oct 2024 22:56:56 +1100 Subject: [PATCH 2/2] remove dupe Signed-off-by: Karl Hepworth --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f500f8f..ac2c391 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,6 @@ filters: &filters workflows: lint-pack: jobs: - - orb-tools/lint - orb-tools/lint - orb-tools/pack - orb-tools/continue: