Skip to content

Commit 71d8c6b

Browse files
committed
chore: initial circleci orb project setup
0 parents  commit 71d8c6b

File tree

25 files changed

+648
-0
lines changed

25 files changed

+648
-0
lines changed

.circleci/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Orb Development Pipeline
2+
3+
This configuration file uses [orb-tools orb]() version 10 to automatically _pack_, _test_, and _publish_ CircleCI orbs using this project structure. View the comments within the config file for a full break down
4+
5+
## Overview:
6+
7+
**Imported Orbs**
8+
9+
Both orb-tools and a development version of your orb will be imported into the config. On the first run, a `dev:alpha` development tag _must_ exist on your orb, but will be handled automatically from there on.
10+
11+
**Jobs**
12+
13+
In the _jobs_ key, you will define _integration tests_. These jobs will utilize the functionality of your orb at run-time and attempt to validate their usage with live examples. Integration tests can be an excellent way of determining issues with parameters and run-time execution.
14+
15+
### Workflows
16+
17+
There are two workflows which automate the pack, test, and publishing process.
18+
19+
**test-pack**
20+
21+
This is the first of the two workflows run. This workflow is responsible for any testing or prepping prior to integration tests. This is where linting occurs, shellchecking, BATS tests, or anything else that can be be tested without the need for further credentials.
22+
23+
This Workflow will be placed on _hold_ prior to publishing a new development version of the orb (based on this commit), as this step requires access to specific publishing credentials.
24+
25+
This allows users to fork the orb repository and begin the pipeline, while the code-owners review that the code is safe to test in an environment where publishing keys will be present.
26+
27+
Once approved, the development version of the orb will publish and the _trigger-integration-tests-workflow_ job will run, kicking off the next workflow
28+
29+
**integration-test_deploy**
30+
31+
The second and final workflow is manually triggered by the _trigger-integration-tests-workflow_ job. In this run, the development version of the orb that was just published will be imported, and the integration tests will run.
32+
33+
When running on the `master` branch (after merging to `master`), the workflow will additionally publish your new production orb.

.circleci/config.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+
bats: circleci/[email protected]
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

.github/ISSUE_TEMPLATE/BUG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: "\U0001F41E Bug report"
3+
about: Report any bugs encountered while using this orb.
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
## Orb version:
11+
12+
<!---
13+
e.g., 1.0.0
14+
find this information in your config.yml file;
15+
if the version is @volatile, check the top of your CircleCI-generated,
16+
expanded configuration file, viewable from the "Configuration" tab of
17+
any job page, for the orb's specific semantic version number
18+
-->
19+
20+
## What happened:
21+
22+
<!---
23+
please include any relevant links to CircleCI workflows or jobs
24+
where you saw this behavior
25+
-->
26+
27+
## Expected behavior:
28+
29+
<!--- what should happen, ideally? -->
30+
31+
## Additional Information:
32+
33+
<!--- Provide any additional context possible. -->
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: "\U0001F680 Feature Request"
3+
about: Propose changes to the orb.
4+
title: ''
5+
labels: feature_request
6+
assignees: ''
7+
---
8+
9+
## Describe Request:
10+
11+
## Examples:
12+
13+
## Supporting Documentation Links:
14+

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
**SEMVER Update Type:**
3+
- [ ] Major
4+
- [ ] Minor
5+
- [ ] Patch
6+
7+
## Description:
8+
9+
<!---
10+
Describe your changes in detail, preferably in an imperative mood,
11+
i.e., "add `commandA` to `jobB`"
12+
-->
13+
14+
## Motivation:
15+
16+
<!---
17+
Share any open issues this PR references or otherwise describe the motivation to submit this pull request.
18+
-->
19+
20+
**Closes Issues:**
21+
- ISSUE URL
22+
23+
## Checklist:
24+
25+
<!--
26+
Thank you for contributing to CircleCI Orbs!
27+
before submitting your a request, please go through the following
28+
items and place an x in the [ ] if they have been completed
29+
-->
30+
31+
- [ ] All new jobs, commands, executors, parameters have descriptions.
32+
- [ ] Usage Example version numbers have been updated.
33+
- [ ] Changelog has been updated.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# orb.yml is "packed" from source, and not published directly from the repository.
2+
orb.yml

.yamllint

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extends: relaxed
2+
3+
rules:
4+
line-length:
5+
max: 200
6+
allow-non-breakable-inline-mappings: true
7+

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
- Current development changes [ to be moved to release ]
9+
10+
## [1.0.0] - YYYY-MM-DD
11+
### Added
12+
- Initial Release
13+
### Changed
14+
- Initial Release
15+
### Removed
16+
- Initial Release
17+
18+
19+
[1.0.0]: GITHUB TAG URL

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 <organization>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)