generated from emmeowzing/circleci-orb-template
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix-anchors: implement testing (#108)
- Fix exploding anchors - implement much-needed testing
- Loading branch information
1 parent
f0060f7
commit a8eb761
Showing
17 changed files
with
204 additions
and
15 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 |
---|---|---|
|
@@ -7,8 +7,8 @@ orbs: | |
orb-tools: circleci/[email protected] | ||
circleci-cli: circleci/[email protected] | ||
# dynamic: bjd2385/dynamic-continuation@dev:alpha | ||
dynamic: bjd2385/dynamic-continuation@3.7.1 | ||
general: bjd2385/general@0.7.8 | ||
dynamic: bjd2385/dynamic-continuation@3.8.0 | ||
general: premiscale/general@1.0.9 | ||
slack: circleci/[email protected] | ||
|
||
|
||
|
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,3 @@ | ||
# Include scripts' changes under src/ | ||
!src/scripts/ | ||
!src/scripts/ | ||
!src/tests/ |
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 |
---|---|---|
|
@@ -4,7 +4,62 @@ version: 2.1 | |
orbs: | ||
orb-tools: circleci/[email protected] | ||
circleci-cli: circleci/[email protected] | ||
general: bjd2385/[email protected] | ||
general: premiscale/[email protected] | ||
# bats: circleci/[email protected] | ||
|
||
|
||
executors: | ||
default: | ||
docker: | ||
- image: cimg/base:2023.12 | ||
|
||
|
||
jobs: | ||
bats-tests: | ||
parameters: | ||
yq-version: | ||
description: |+ | ||
Version of yq to install. | ||
https://github.com/mikefarah/yq/releases | ||
type: string | ||
default: 4.40.5 | ||
tests-directory: | ||
description: Directory in which bats tests reside. | ||
type: string | ||
default: tests/ | ||
formatter: | ||
description: Bats formatter. | ||
type: string | ||
default: tap | ||
resource-class: | ||
description: Resource class to execute as. | ||
type: enum | ||
default: small | ||
enum: | ||
- small | ||
- medium | ||
- large | ||
- 2xlarge | ||
executor: default | ||
resource_class: << parameters.resource-class >> | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install bats | ||
command: |+ | ||
sudo apt update | ||
sudo apt install -y bats | ||
- run: | ||
name: Install yq | ||
command: |+ | ||
wget https://github.com/mikefarah/yq/releases/download/v<< parameters.yq-version >>/yq_linux_amd64 -o yq | ||
sudo install yq /usr/bin/yq | ||
rm yq | ||
- run: | ||
name: Bats tests | ||
command: |+ | ||
bats --formatter << parameters.formatter >> --timing --recursive << parameters.tests-directory >> | ||
workflows: | ||
|
@@ -18,10 +73,20 @@ workflows: | |
max_command_length: 256 | ||
resource_class: small | ||
|
||
# - bats/run: | ||
# path: ./src/tests | ||
# save_test_results: true | ||
# # setup-steps: | ||
|
||
- bats-tests: | ||
tests-directory: ./src/tests/ | ||
|
||
- general/orb-pack: | ||
requires: | ||
- orb-tools/lint | ||
- orb-tools/review | ||
# - bats/run | ||
- bats-tests | ||
|
||
- orb-tools/publish: | ||
name: publish development 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
ko_fi: bjd2385 | ||
ko_fi: emmeowzing |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
external-sources=true | ||
exclude=SC2288,SC2001,SC2148,SC2153 |
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,3 +1,3 @@ | ||
nodejs 20.10.0 | ||
nodejs 18.9.0 | ||
yarn 1.22.19 | ||
shellcheck 0.9.0 |
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
Empty file.
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
Empty file.
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,56 @@ | ||
#! /usr/bin/env bats | ||
# Compare the results of reduction to the expected outcome. | ||
|
||
|
||
export ISSUE_NUMBER=105 | ||
export SH_CONTINUE_CONFIG=/tmp/continue-config.yml | ||
export SH_MODULES_FILTERED=/tmp/modules-filtered.txt | ||
export SH_ROOT_CONFIG=app | ||
export EXPECTED_CONFIG=src/tests/data/"$ISSUE_NUMBER"/expected-result.yml | ||
|
||
|
||
## | ||
# Set up test environment. | ||
setup() | ||
{ | ||
printf "example-1\\nexample-2" > "$SH_MODULES_FILTERED" | ||
|
||
# Copy our test data -> /.circleci/ | ||
cp src/tests/data/"$ISSUE_NUMBER"/example-{1,2}.yml .circleci/ | ||
} | ||
|
||
|
||
## | ||
# Clean up test environment. | ||
clean() | ||
{ | ||
rm "${SH_MODULES_FILTERED:?}" | ||
rm .circleci/example-{1,2}.yml | ||
} | ||
|
||
|
||
## | ||
# Show diff output. | ||
_diff() | ||
{ | ||
diff -d -r -y <(yq -rM "$SH_CONTINUE_CONFIG") <(yq -rM "$EXPECTED_CONFIG") | ||
} | ||
|
||
|
||
@test reduce_exploded_yaml_anchors { | ||
setup | ||
|
||
./src/scripts/reduce.sh | ||
|
||
if [ "$(yq -rM '.' "$SH_CONTINUE_CONFIG")" != "$(yq -rM '.' "$EXPECTED_CONFIG")" ]; then | ||
_diff | ||
printf "\\n" | ||
clean | ||
return 1 | ||
fi | ||
|
||
clean | ||
} | ||
|
||
|
||
# TODO: write another test that checks that it purposely fails w/o the explode? |
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,10 @@ | ||
jobs: | ||
contexts: &contexts | ||
- circleci3 | ||
- circleci4 | ||
|
||
workflows: | ||
example-1: | ||
jobs: | ||
- job1: | ||
context: *contexts |
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,11 @@ | ||
jobs: | ||
contexts: &contexts | ||
- circleci3 | ||
- circleci4 | ||
|
||
|
||
workflows: | ||
example-2: | ||
jobs: | ||
- job1: | ||
context: *contexts |
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,17 @@ | ||
jobs: | ||
contexts: | ||
- circleci3 | ||
- circleci4 | ||
workflows: | ||
example-1: | ||
jobs: | ||
- job1: | ||
context: | ||
- circleci3 | ||
- circleci4 | ||
example-2: | ||
jobs: | ||
- job1: | ||
context: | ||
- circleci3 | ||
- circleci4 |
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 @@ | ||
#! /usr/bin/env bats |