-
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.
[semver:major] feat: add set-shas command (#1)
* feat: set-sha-command * [semver: major]: feat: add set-shas command * [semver: skip]: docs: update readme * feat(set-shas): move all logic to node script * feat(set-shas): add sha information to output * feat(set-shas): update examples * docs(set-shas): add usage to README.md * fix(set-shas): remove bats reference * fix(set-shas): remove shellcheck * fix: command structure * feat(circleci): extract project slug from build url * chore(circleci): update path * chore(circleci): include script * chore(circleci): inject script
- Loading branch information
Showing
24 changed files
with
322 additions
and
415 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,61 @@ | ||
# Contributing to nx-orb | ||
|
||
We welcome [issues](https://github.com/nrwl/nx-orb/issues) to and [pull requests](https://github.com/nrwl/nx-orb/pulls) against this repository! Read this document to see how to do it. | ||
|
||
## How to Contribute | ||
* 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 should follow [commit message guideline](#commit-message-guideline) | ||
* 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. | ||
|
||
#### Commit Message Guidelines | ||
|
||
The commit message should follow the following format: | ||
|
||
``` | ||
[semver:<segment>] type: subject | ||
BLANK LINE | ||
body | ||
``` | ||
|
||
##### Semver tag | ||
|
||
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]` | ||
|
||
##### Type | ||
|
||
The type must be one of the following: | ||
|
||
- feat - New or improved behavior being introduced (e.g. adding new command) | ||
- fix - Fixes the current unexpected behavior to match expected behavior (e.g. fixing the wrong commit search logic) | ||
- cleanup - Code Style changes that have little to no effect on the user (e.g. Refactoring some function) | ||
- docs - Changes to the documentation (e.g. Adding more details into the examples) | ||
- chore - Changes that have absolutely no effect on users (e.g. Renaming files) | ||
|
||
Optionally, type can have a scope (e.g. `feat(set-shas)`) | ||
|
||
##### Subject and Body | ||
|
||
The subject must contain a description of the change, and the body of the message contains any additional details to provide more context about the change. | ||
|
||
Including the issue number that the PR relates to also helps with tracking. | ||
|
||
##### Example | ||
|
||
``` | ||
[semver:minor] feat(set-shas): add optinal workflow-id | ||
Add workflow-id to filter successful workflows | ||
Closes #157 | ||
``` |
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
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,41 +1,69 @@ | ||
# Orb Project Template | ||
<p style="text-align: center;"><img src=".github/assets/nx.png" | ||
width="100%" alt="Nx - Smart, Extensible Build Framework"></p> | ||
|
||
<h1 align="center">NX Orb</h2> | ||
|
||
[![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 CircleCI Orb which includes helpful commands for running Nx commands in the CI | ||
## Usage | ||
|
||
```yaml | ||
version: 2.1 | ||
|
||
orbs: | ||
nx: nrwl/nx@1.0.0 | ||
|
||
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). | ||
jobs: | ||
checks: | ||
docker: | ||
- image: cimg/node:14.17-browsers | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install dependencies | ||
command: yarn install --frozen-lockfile | ||
- nx/set-shas | ||
- run: | ||
name: Run Builds | ||
command: yarn nx affected --target=build --base=$NX_BASE --parallel | ||
- run: | ||
name: Run Unit Tests | ||
command: yarn nx affected --target=test --base=$NX_BASE --parallel | ||
``` | ||
Additional READMEs are available in each directory. | ||
## Background | ||
When we run `affected` command on [Nx](https://nx.dev/), we can specify 2 git history positions - base and head, and it calculates [which projects in your repository changed | ||
between those 2 commits](https://nx.dev/latest/angular/tutorial/11-test-affected-projects#step-11-test-affected-projects | ||
). We can then run a set of tasks (like building or linting) only on those **affected** projects. | ||
|
||
This makes it easy to set-up a CI system that scales well with the continous growth of your repository, as you add more and more projects. | ||
|
||
## Resources | ||
### Problem | ||
|
||
[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. | ||
Figuring out what these two git commits are might not be as simple as it seems. | ||
|
||
### How to Contribute | ||
On a CI system that runs on submitted PRs, we determine what commits to include in the **affected** calculation by comparing our `HEAD-commit-of-PR-branch` to the commit in main branch (`master` or `main` usually) from which the PR branch originated. This will ensure the entirety of our PR is always being tested. | ||
|
||
We welcome [issues](https://github.com/nrwl/nx-orb/issues) to and [pull requests](https://github.com/nrwl/nx-orb/pulls) against this repository! | ||
But what if we want to set up a continuous deployment system | ||
that, as changes get pushed to `master`, it builds and deploys | ||
only the affected projects? | ||
|
||
### 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. | ||
What are the `FROM` and `TO` commits in that case? | ||
|
||
| 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| | ||
Conceptually, what we want is to use the absolute latest commit on the `master` branch as the HEAD, and the previous _successful_ commit on `master` as the BASE. Note, we want the previous _successful_ one because it is still possible for commits on the `master` branch to fail for a variety of reasons. | ||
|
||
Example: `[semver:major]` | ||
The commits therefore can't just be `HEAD` and `HEAD~1`. If a few deployments fail one after another, that means that we're accumulating a list of affected projects that are not getting deployed. Anytime we retry the deployment, we want to include **every commit since the last time we deployed successfully**. That way we ensure we don't accidentally skip deploying a project that has changed. | ||
|
||
* 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. | ||
This action enables you to find: | ||
* Commit SHA from which PR originated (in the case of `pull_request`) | ||
* Commit SHA of the last successful CI run | ||
|
||
## License | ||
|
||
For further questions/comments about this or other orbs, visit the Orb Category of [CircleCI Discuss](https://discuss.circleci.com/c/orbs). | ||
[MIT](http://opensource.org/licenses/MIT) | ||
|
||
Copyright (c) 2021-present Narwhal Technologies Inc. |
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,15 +1,8 @@ | ||
version: 2.1 | ||
|
||
description: > | ||
Sample orb description | ||
# What will your orb allow users to accomplish? | ||
# Descriptions should be short, simple, and informative. | ||
A Orb which includes helpful commands for running Nx commands in the CI | ||
# 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 | ||
home_url: "https://nx.dev/" | ||
source_url: "https://github.com/nrwl/nx-orb" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.