Skip to content

Commit

Permalink
chore: check commands
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Jul 23, 2021
1 parent c090b4d commit 778e465
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
32 changes: 15 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
version: 2.1

orbs:
# Replace this with your own!
nx: nrwl/nx@<<pipeline.parameters.dev-orb-version>>
orb-tools: circleci/orb-tools@10.0

# Pipeline Parameters
## These parameters are used internally by orb-tools. Skip to the Jobs section.
parameters:
# These pipeline parameters are required by the "trigger-integration-tests-workflow"
# job, by default.
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.
set-shas-integration-test:
docker:
- image: cimg/node:14.17-browsers
- image: cimg/base:stable
steps:
- checkout
- nx/greetme
- nx/set-shas

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
- orb-tools/lint
- orb-tools/pack:
use-orb-pack: true
- hold-for-dev-publish:
type: approval
requires:
- orb-tools/lint
- orb-tools/pack
# 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
- 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:
Expand All @@ -70,13 +69,12 @@ workflows:
- orb-tools/dev-promote-prod-from-commit-subject:
orb-name: nrwl/nx
context: orb-publishing
add-pr-comment: false
add-pr-comment: true
fail-if-semver-not-indicated: true
publish-version-tag: false
publish-version-tag: true
requires:
- set-shas-integration-test
filters:
branches:
only:
- master
- main
23 changes: 23 additions & 0 deletions src/commands/greetme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
description: >
Derives SHAs for base and head for use in `nx affected` commands in CI
parameters:
main-branch-name:
type: string
default: main
description: >
The name of the main branch in your repo, used as the target of PRs. E.g. main, master etc.
error-on-no-successful-workflow:
type: boolean
default: false
description: >
By default, if no successful workflow is found on the main branch to determine the SHA,
we will log a warning and use HEAD~1. Enable this option to error and exit instead.
steps:
- run:
environment:
PARAM_MAIN_BRANCH: <<parameters.main-branch-name>>
PARAM_ERROR_ON_NO_SUCCESSFUL_WORKFLOW: <<parameters.error-on-no-successful-workflow>>
name: Derives SHAs for base and head for use in `nx affected` commands
shell: "/bin/bash"
command: echo "I was done"

0 comments on commit 778e465

Please sign in to comment.