-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added the orb file.
- Loading branch information
Surya Teja
authored
Oct 17, 2019
1 parent
35c8056
commit b4d81d3
Showing
4 changed files
with
175 additions
and
2 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,37 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
cli: | ||
docker: | ||
- image: circleci/circleci-cli:0.1.2709 | ||
|
||
jobs: | ||
validate: | ||
executor: cli | ||
steps: | ||
- checkout | ||
- run: | ||
name: Validate orb | ||
command: | ||
make validate | ||
|
||
dev-release: | ||
executor: cli | ||
steps: | ||
- checkout | ||
- run: | ||
name: Publish dev version of the orb | ||
command: | | ||
make dev-release | ||
workflows: | ||
main: | ||
jobs: | ||
- validate | ||
|
||
# CircleCI personal tokens are visible in the logs. Hence not publishing automatically until it is resolved (https://ideas.circleci.com/ideas/CCI-I-397). | ||
|
||
# - dev-release: | ||
# requires: | ||
# - validate | ||
|
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,13 @@ | ||
.PHONY: validate | ||
validate: | ||
circleci orb validate src/orb.yml | ||
|
||
.PHONY: dev-release | ||
dev-release: | ||
@$(MAKE) validate | ||
circleci orb publish src/orb.yml niteo/check-untracked-changes@dev:${tag} | ||
|
||
.PHONY: prod-release | ||
prod-release: | ||
@$(MAKE) validate | ||
circleci orb publish src/orb.yml niteo/check-untracked-changes@${tag} |
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 |
---|---|---|
@@ -1,2 +1,67 @@ | ||
# check-untracked-changes | ||
TODO | ||
# Check Un-tracked Changes Orb | ||
[](https://circleci.com/gh/niteoweb/check-untracked-changes/tree/master) | ||
|
||
An orb to test if any un-tracked changes(to git commit) are present in the given path. | ||
This is useful to test if any auto-formatters(like black, codegen) have produced changes during CI validation. | ||
|
||
|
||
## Example Usage | ||
```yml | ||
version: 2.1 | ||
|
||
orbs: | ||
untracked_changes: niteo/[email protected] | ||
jobs: | ||
test: | ||
docker: | ||
- image: circleci/python:3.7 # Can be any executor | ||
steps: | ||
- checkout | ||
|
||
# Run auto-formatter commands | ||
- run: pip install black | ||
- run: black src/ | ||
|
||
# Fail if changes are produced | ||
- untracked_changes/check: | ||
path: "src/" | ||
|
||
workflows: | ||
test-format: | ||
jobs: | ||
- test | ||
``` | ||
## Development | ||
* To see all the existing orbs in the organization, run: | ||
```bash | ||
$ circleci orb list niteo | ||
``` | ||
|
||
* To validate the orb, run: | ||
```bash | ||
$ make validate | ||
``` | ||
|
||
* You can publish a **dev** version of the orb for testing before publishing a production immutable version. To publish a dev version of 1.0.1, run: | ||
```bash | ||
$ make dev-release tag=1.0.1 | ||
``` | ||
|
||
> Note: It is always a good practice to test a dev version of the orb first before publishing new public version. | ||
|
||
## Publishing Orb | ||
|
||
* Make sure you have privileges to publish the orb to production. | ||
* Once the dev version is tested, You can publish a new orb version manually, by specifying new version: | ||
```bash | ||
$ make prod-release tag=1.0.1 | ||
``` | ||
> Note: Once the new version of orb is published, the same can be tagged in the Github releases. | ||
|
||
## Additional Information | ||
Authoring orb: https://circleci.com/docs/2.0/orb-author/ |
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,58 @@ | ||
version: 2.1 | ||
description: >- | ||
An orb command to test if any un-tracked changes(to git commit) are present in the given path. | ||
This is useful to check if any auto-formatters(like black, codegen) have produced changes during CI validation. | ||
############################################ | ||
# ---- Commands ---- # | ||
# Command to check the un-tracked changes. # | ||
############################################ | ||
commands: | ||
check: | ||
description: Check un-tracked changes in the given path | ||
parameters: | ||
path: | ||
description: Path to check | ||
type: string | ||
default: "." | ||
steps: | ||
- run: | ||
name: Check un-tracked changes using git porcelain command | ||
command: | | ||
if [[ `git status <<parameters.path>> --porcelain` ]] | ||
then | ||
echo "ERROR: running the previous command has introduced changes. Hence, Failing the build." | ||
git status --porcelain | ||
exit 1 | ||
fi | ||
###################################### | ||
# ---- Examples & Usage ---- # | ||
###################################### | ||
|
||
examples: | ||
format_test: | ||
description: Test if the files are formatted | ||
usage: | ||
version: 2.1 | ||
orbs: | ||
untracked_changes: niteo/[email protected] | ||
jobs: | ||
test: | ||
docker: | ||
- image: circleci/python:3.7 # Can be any executor | ||
steps: | ||
- checkout | ||
|
||
# Run auto formatter commands | ||
|
||
# Fail if changes are produced | ||
- untracked_changes/check: | ||
path: "src/" | ||
|
||
workflows: | ||
test-format: | ||
jobs: | ||
- test |