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