-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 76957d8
Showing
25 changed files
with
648 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Orb Development Pipeline | ||
|
||
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 | ||
|
||
## Overview: | ||
|
||
**Imported Orbs** | ||
|
||
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. | ||
|
||
**Jobs** | ||
|
||
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. | ||
|
||
### Workflows | ||
|
||
There are two workflows which automate the pack, test, and publishing process. | ||
|
||
**test-pack** | ||
|
||
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. | ||
|
||
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. | ||
|
||
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. | ||
|
||
Once approved, the development version of the orb will publish and the _trigger-integration-tests-workflow_ job will run, kicking off the next workflow | ||
|
||
**integration-test_deploy** | ||
|
||
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. | ||
|
||
When running on the `master` branch (after merging to `master`), the workflow will additionally publish your new production orb. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
# Replace this with your own! | ||
nx: nrwl/nx@<<pipeline.parameters.dev-orb-version>> | ||
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" | ||
|
||
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. | ||
- nx/greet | ||
|
||
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 | ||
# optional: Run BATS tests against your scripts | ||
- bats/run: | ||
path: ./src/tests | ||
# Publish development version(s) of the orb. | ||
- orb-tools/publish-dev: | ||
orb-name: nrwl/nx | ||
context: orb-publishing # A restricted context containing your private publishing credentials. Will only execute if approved by an authorized user. | ||
requires: | ||
- orb-tools/lint | ||
- orb-tools/pack | ||
- bats/run | ||
- shellcheck/check | ||
# 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 <your orb>@dev:${CIRCLE_SHA1:0:7}. | ||
integration-test_deploy: | ||
when: << pipeline.parameters.run-integration-tests >> | ||
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: nrwl/nx | ||
context: orb-publishing | ||
add-pr-comment: false | ||
fail-if-semver-not-indicated: true | ||
publish-version-tag: false | ||
requires: | ||
- integration-test-1 | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
- main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
name: "\U0001F41E Bug report" | ||
about: Report any bugs encountered while using this orb. | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Orb version: | ||
|
||
<!--- | ||
e.g., 1.0.0 | ||
find this information in your config.yml file; | ||
if the version is @volatile, check the top of your CircleCI-generated, | ||
expanded configuration file, viewable from the "Configuration" tab of | ||
any job page, for the orb's specific semantic version number | ||
--> | ||
|
||
## What happened: | ||
|
||
<!--- | ||
please include any relevant links to CircleCI workflows or jobs | ||
where you saw this behavior | ||
--> | ||
|
||
## Expected behavior: | ||
|
||
<!--- what should happen, ideally? --> | ||
|
||
## Additional Information: | ||
|
||
<!--- Provide any additional context possible. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: "\U0001F680 Feature Request" | ||
about: Propose changes to the orb. | ||
title: '' | ||
labels: feature_request | ||
assignees: '' | ||
--- | ||
|
||
## Describe Request: | ||
|
||
## Examples: | ||
|
||
## Supporting Documentation Links: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blank_issues_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
**SEMVER Update Type:** | ||
- [ ] Major | ||
- [ ] Minor | ||
- [ ] Patch | ||
|
||
## Description: | ||
|
||
<!--- | ||
Describe your changes in detail, preferably in an imperative mood, | ||
i.e., "add `commandA` to `jobB`" | ||
--> | ||
|
||
## Motivation: | ||
|
||
<!--- | ||
Share any open issues this PR references or otherwise describe the motivation to submit this pull request. | ||
--> | ||
|
||
**Closes Issues:** | ||
- ISSUE URL | ||
|
||
## Checklist: | ||
|
||
<!-- | ||
Thank you for contributing to CircleCI Orbs! | ||
before submitting your a request, please go through the following | ||
items and place an x in the [ ] if they have been completed | ||
--> | ||
|
||
- [ ] All new jobs, commands, executors, parameters have descriptions. | ||
- [ ] Usage Example version numbers have been updated. | ||
- [ ] Changelog has been updated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# orb.yml is "packed" from source, and not published directly from the repository. | ||
orb.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extends: relaxed | ||
|
||
rules: | ||
line-length: | ||
max: 200 | ||
allow-non-breakable-inline-mappings: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
- Current development changes [ to be moved to release ] | ||
|
||
## [1.0.0] - YYYY-MM-DD | ||
### Added | ||
- Initial Release | ||
### Changed | ||
- Initial Release | ||
### Removed | ||
- Initial Release | ||
|
||
|
||
[1.0.0]: GITHUB TAG URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 <organization> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Orb Project Template | ||
|
||
[![CircleCI Build Status](https://circleci.com/gh/nrwl/nx-orb.svg?style=shield "CircleCI Build Status")](https://circleci.com/gh/nrwl/nx-orb) [![CircleCI Orb Version](https://badges.circleci.com/orbs/nrwl/nx.svg)](https://circleci.com/orbs/registry/orb/nrwl/nx) [![GitHub License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/nrwl/nx-orb/master/LICENSE) [![CircleCI Community](https://img.shields.io/badge/community-CircleCI%20Discuss-343434.svg)](https://discuss.circleci.com/c/ecosystem/orbs) | ||
|
||
|
||
|
||
A starter template for orb projects. Build, test, and publish orbs automatically on CircleCI with [Orb-Tools](https://circleci.com/orbs/registry/orb/circleci/orb-tools). | ||
|
||
Additional READMEs are available in each directory. | ||
|
||
|
||
|
||
## Resources | ||
|
||
[CircleCI Orb Registry Page](https://circleci.com/orbs/registry/orb/nrwl/nx-orb) - The official registry page of this orb for all versions, executors, commands, and jobs described. | ||
[CircleCI Orb Docs](https://circleci.com/docs/2.0/orb-intro/#section=configuration) - Docs for using and creating CircleCI Orbs. | ||
|
||
### How to Contribute | ||
|
||
We welcome [issues](https://github.com/nrwl/nx-orb/issues) to and [pull requests](https://github.com/nrwl/nx-orb/pulls) against this repository! | ||
|
||
### How to Publish | ||
* Create and push a branch with your new features. | ||
* When ready to publish a new production version, create a Pull Request from _feature branch_ to `master`. | ||
* The title of the pull request must contain a special semver tag: `[semver:<segment>]` where `<segment>` is replaced by one of the following values. | ||
|
||
| Increment | Description| | ||
| ----------| -----------| | ||
| major | Issue a 1.0.0 incremented release| | ||
| minor | Issue a x.1.0 incremented release| | ||
| patch | Issue a x.x.1 incremented release| | ||
| skip | Do not issue a release| | ||
|
||
Example: `[semver:major]` | ||
|
||
* Squash and merge. Ensure the semver tag is preserved and entered as a part of the commit message. | ||
* On merge, after manual approval, the orb will automatically be published to the Orb Registry. | ||
|
||
|
||
For further questions/comments about this or other orbs, visit the Orb Category of [CircleCI Discuss](https://discuss.circleci.com/c/orbs). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 2.1 | ||
|
||
description: > | ||
Sample orb description | ||
# What will your orb allow users to accomplish? | ||
# Descriptions should be short, simple, and informative. | ||
|
||
# This information will be displayed in the orb registry and is not mandatory. | ||
display: | ||
home_url: "https://www.website.com/docs" | ||
source_url: "https://www.github.com/EXAMPLE_ORG/EXAMPLE_PROJECT" | ||
|
||
# If your orb requires other orbs, you can import them like this. Otherwise remove the "orbs" stanza. | ||
# orbs: | ||
# hello: circleci/hello-build@0.0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Orb Source | ||
|
||
Orbs are shipped as individual `orb.yml` files, however, to make development easier, it is possible to author an orb in _unpacked_ form, which can be _packed_ with the CircleCI CLI and published. | ||
|
||
The default `.circleci/config.yml` file contains the configuration code needed to automatically pack, test, and deploy and changes made to the contents of the orb source in this directory. | ||
|
||
## @orb.yml | ||
|
||
This is the entry point for our orb "tree", which becomes our `orb.yml` file later. | ||
|
||
Within the `@orb.yml` we generally specify 4 configuration keys | ||
|
||
**Keys** | ||
|
||
1. **version** | ||
Specify version 2.1 for orb-compatible configuration `version: 2.1` | ||
2. **description** | ||
Give your orb a description. Shown within the CLI and orb registry | ||
3. **display** | ||
Specify the `home_url` referencing documentation or product URL, and `source_url` linking to the orb's source repository. | ||
4. **orbs** | ||
(optional) Some orbs may depend on other orbs. Import them here. | ||
|
||
## See: | ||
- [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration) | ||
- [Reusable Configuration](https://circleci.com/docs/2.0/reusing-config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Commands | ||
|
||
Easily add and author [Reusable Commands](https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands) to the `src/commands` directory. | ||
|
||
Each _YAML_ file within this directory will be treated as an orb command, with a name which matches its filename. | ||
|
||
View the included _[greet.yml](./greet.yml)_ example. | ||
|
||
```yaml | ||
description: > | ||
Replace this text with a description for this command. | ||
# What will this command do? | ||
# Descriptions should be short, simple, and clear. | ||
parameters: | ||
greeting: | ||
type: string | ||
default: "Hello" | ||
description: "Select a proper greeting" | ||
steps: | ||
- run: | ||
name: Hello World | ||
command: echo << parameters.greeting >> world | ||
``` | ||
## See: | ||
- [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration) | ||
- [How to author commands](https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands) |
Oops, something went wrong.