Skip to content

Commit f07833d

Browse files
authored
Merge pull request #2 from browserstack/init-browserstack-orb
Init browserstack orb
2 parents ee8ab5b + 35a4fe4 commit f07833d

File tree

16 files changed

+433
-0
lines changed

16 files changed

+433
-0
lines changed

.circleci/config.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: 2.1
2+
setup: true
3+
orbs:
4+
orb-tools: circleci/[email protected]
5+
shellcheck: circleci/[email protected]
6+
7+
filters: &filters
8+
tags:
9+
only: /.*/
10+
11+
workflows:
12+
lint-pack:
13+
jobs:
14+
- orb-tools/lint:
15+
filters: *filters
16+
- orb-tools/pack:
17+
filters: *filters
18+
- orb-tools/review:
19+
orb_name: browserstack-circleci-orb
20+
filters: *filters
21+
- shellcheck/check:
22+
filters: *filters
23+
# Triggers the next workflow in the Orb Development Kit.
24+
- orb-tools/continue:
25+
pipeline_number: << pipeline.number >>
26+
vcs_type: github
27+
orb_name: browserstack-circleci-orb
28+
requires: [orb-tools/lint, orb-tools/pack, orb-tools/review, shellcheck/check]
29+
filters: *filters

.circleci/test-deploy.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: 2.1
2+
orbs:
3+
# Your orb will be automatically injected here during the pipeline.
4+
# Reference your orb's jobs and commands below as they will exist when built.
5+
orb-tools: circleci/[email protected]
6+
# The orb definition is intentionally not included here. It will be injected into the pipeline.
7+
browserstack-circleci-orb: {}
8+
9+
# Use this tag to ensure test jobs always run,
10+
# even though the downstream publish job will only run on release tags.
11+
filters: &filters
12+
tags:
13+
only: /.*/
14+
15+
# Filter for release tags.
16+
release-filters: &release-filters
17+
branches:
18+
ignore: /.*/
19+
tags:
20+
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
21+
22+
jobs:
23+
# Create jobs to test the commands of your orbs.
24+
# You may want to add additional validation steps to ensure the commands are working as expected.
25+
command-test:
26+
docker:
27+
- image: cimg/base:current
28+
steps:
29+
- checkout
30+
# Run your orb's commands to validate them.
31+
- browserstack-circleci-orb/set_rerun_tests
32+
workflows:
33+
test-deploy:
34+
jobs:
35+
# Make sure to include "filters: *filters" in every test job you want to run as part of your deployment.
36+
# Test your orb's commands in a custom job and test your orb's jobs directly as a part of this workflow.
37+
- command-test:
38+
filters: *filters
39+
# The orb must be re-packed for publishing, and saved to the workspace.
40+
- orb-tools/pack:
41+
filters: *release-filters
42+
- orb-tools/publish:
43+
orb_name: browserstack/browserstack-circleci-orb
44+
vcs_type: github
45+
pub_type: production
46+
# Ensure this job requires all test jobs and the pack job.
47+
requires:
48+
- orb-tools/pack
49+
- command-test
50+
context: orb-publishing
51+
filters: *release-filters

.github/ISSUE_TEMPLATE/BUG.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "\U0001F41E Bug Report"
2+
description: Report any identified bugs.
3+
title: 'Bug: '
4+
labels: [bug]
5+
# assignees: ''
6+
body:
7+
- type: checkboxes
8+
attributes:
9+
label: "Is there an existing issue for this?"
10+
description: "Please search [here](https://github.com/<organization>/<project-name>/issues?q=is%3Aissue) to see if an issue already exists for the bug you encountered"
11+
options:
12+
- label: "I have searched the existing issues"
13+
required: true
14+
15+
- type: input
16+
attributes:
17+
label: "Orb version"
18+
description: |
19+
Which version of `<namespace>/<orb-name>` are you using?
20+
placeholder: "1.0.0"
21+
22+
- type: textarea
23+
validations:
24+
required: true
25+
attributes:
26+
label: "Current behavior"
27+
description: "How does the issue manifest?"
28+
29+
- type: textarea
30+
validations:
31+
required: true
32+
attributes:
33+
label: "Minimum reproduction config"
34+
description: "Enter a URL to a failed build or write a config example to reproduce the issue"
35+
placeholder: "https://app.circleci.com/..."
36+
37+
- type: textarea
38+
attributes:
39+
label: "Other"
40+
description: |
41+
Anything else you want to share?
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "\U0001F4A1 Feature Request"
2+
description: Have an idea for a new feature? Begin by submitting a Feature Request
3+
title: 'Request: '
4+
labels: [enhancement]
5+
# assignees: ''
6+
body:
7+
- type: checkboxes
8+
attributes:
9+
label: "Is there an existing issue that is already proposing this?"
10+
description: "Please search [here](https://github.com/CircleCI-Public/circleci-config-sdk-ts/issues?q=is%3Aissue) to see if an issue already exists for the feature you are requesting"
11+
options:
12+
- label: "I have searched the existing issues"
13+
required: true
14+
15+
- type: textarea
16+
validations:
17+
required: true
18+
attributes:
19+
label: "Describe the problem imposed by not having this feature"
20+
description: "Please describe the use-case you are attempting to implement, and the current limitations you are facing."
21+
22+
- type: textarea
23+
validations:
24+
required: true
25+
attributes:
26+
label: "Describe the solution you'd like"
27+
description: "A clear and concise description of what you want to happen. Add any considered drawbacks"
28+
29+
30+
- type: textarea
31+
attributes:
32+
label: "Other"
33+
description: |
34+
Anything else you want to share?
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## PR Type
2+
What kind of change does this PR introduce?
3+
4+
<!-- Please check the one that applies to this PR using "x". -->
5+
- [ ] Bugfix
6+
- [ ] Feature
7+
- [ ] Code style update (formatting)
8+
- [ ] Refactoring (no functional changes)
9+
- [ ] CI related changes
10+
- [ ] Other... Please describe:
11+
12+
## What is the current behavior?
13+
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
14+
15+
Issue Number: N/A
16+
17+
## What is the new behavior?
18+
19+
## Does this PR introduce a breaking change?
20+
- [ ] Yes
21+
- [ ] No
22+
23+
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
24+
25+
## Other information

.gitignore

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

.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+

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) 2023 <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.

src/@orb.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2.1
2+
3+
description: >
4+
Browserstack orb to set custom job-scope variables for a user config.
5+
# What will your orb allow users to accomplish?
6+
# Descriptions should be short, simple, and informative.
7+
8+
# This information will be displayed in the orb registry and is not mandatory.
9+
display:
10+
home_url: "https://browserstack.com"
11+
source_url: "https://github.com/browserstack/browserstack-circleci-orb"
12+
13+
# If your orb requires other orbs, you can import them like this. Otherwise remove the "orbs" stanza.
14+
# orbs:
15+
# hello: circleci/[email protected]

src/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Orb Source
2+
3+
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.
4+
5+
The default `.circleci/config.yml` file contains the configuration code needed to automatically pack, test, and deploy any changes made to the contents of the orb source in this directory.
6+
7+
## @orb.yml
8+
9+
This is the entry point for our orb "tree", which becomes our `orb.yml` file later.
10+
11+
Within the `@orb.yml` we generally specify 4 configuration keys
12+
13+
**Keys**
14+
15+
1. **version**
16+
Specify version 2.1 for orb-compatible configuration `version: 2.1`
17+
2. **description**
18+
Give your orb a description. Shown within the CLI and orb registry
19+
3. **display**
20+
Specify the `home_url` referencing documentation or product URL, and `source_url` linking to the orb's source repository.
21+
4. **orbs**
22+
(optional) Some orbs may depend on other orbs. Import them here.
23+
24+
## See:
25+
- [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration)
26+
- [Reusable Configuration](https://circleci.com/docs/2.0/reusing-config)

src/commands/set_rerun_tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
description: "Cleanup the project level environment variable set by browserstack rerun API"
2+
3+
steps:
4+
- run:
5+
name: Set Rerun Tests
6+
command: <<include(scripts/rerun_tests.sh)>>
7+
environment:
8+
CLEANUP_ENV_VAR: true

src/examples/cleanup_env.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
description: |
2+
This example demonstrates how to use the BrowserStack CircleCI Orb to clean up the project environment variables after the test execution.
3+
4+
usage:
5+
version: 2.1
6+
orbs:
7+
browserstack-circleci-orb: browserstack/[email protected]
8+
workflows:
9+
cleanup-job-example:
10+
jobs:
11+
- my_test_job
12+
- browserstack-circleci-orb/cleanup_env:
13+
requires:
14+
- my_test_job

src/examples/set_rerun_tests.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
description: |
2+
This example demonstrates how to use browserstack rerun tests command & set it in job environment variable.
3+
4+
usage:
5+
version: 2.1
6+
orbs:
7+
browserstack-circleci-orb: browserstack/[email protected]
8+
9+
jobs:
10+
my_test_job:
11+
executor: default
12+
steps:
13+
- checkout
14+
- browserstack-circleci-orb/set_rerun_tests:
15+
delete_env_var: true # Default value is False
16+
- run:
17+
name: Run Test
18+
command: |
19+
echo "Bs Tests: $BSTACK_RERUN_TESTS"
20+
workflows:
21+
set-rerun-tests-example:
22+
jobs:
23+
- my_test_job

src/executors/default.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description: >
2+
This is a sample executor using Docker and Node. If you want to provide a custom environment in your orb, insert your image here.
3+
If you do not require an executor, you can simply delete this directory.
4+
docker:
5+
- image: 'cimg/node:<<parameters.tag>>'
6+
parameters:
7+
tag:
8+
default: lts
9+
description: >
10+
Pick a specific cimg/node image variant:
11+
https://hub.docker.com/r/cimg/node/tags
12+
type: string

src/jobs/cleanup_env.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
description: "Cleanup the project level environment variable"
2+
3+
executor: default
4+
5+
steps:
6+
- run:
7+
name: Cleanup Environment
8+
command: <<include(scripts/rerun_tests.sh)>>
9+
environment:
10+
CLEANUP_ENV_VAR: true

0 commit comments

Comments
 (0)