Skip to content

Commit

Permalink
chore: move test to script
Browse files Browse the repository at this point in the history
  • Loading branch information
Shurtu-gal committed Jan 11, 2024
1 parent bfe92a8 commit 180ced3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
15 changes: 1 addition & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,8 @@ test: test-default test-validate-success test-validate-fail test-custom-output t
# Test cases

# Tests if the action has been bumped greater than the latest release
# sed "s/docker:\/\/asyncapi\/github-action-for-cli:.*/docker:\/\/asyncapi\/github-action-for-cli:$$version'/g" action.yml > action.yml.tmp
REGEX = docker:\/\/asyncapi\/github-action-for-cli:([0-9.]+)
test-action-bump:
@bash version=$$(cat package.json | jq -r '.version'); \
action=$$(cat action.yml); \
[[ $$action =~ $(REGEX) ]]; \
action_version=$${BASH_REMATCH[1]}; \
echo "Action version: $$action_version"; \
echo "Package version: $$version"; \
if [[ $$action_version > $$version ]]; then \
echo "Action version is greater than package version"; \
else \
echo "Action version has not been bumped. Please bump the action version to the semantically correct version after $$version"; \
exit 1; \
fi
@bash bump-test.sh

# Tests the default configuration without any inputs
test-default:
Expand Down
19 changes: 19 additions & 0 deletions bump-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

version=$(cat package.json | jq -r '.version');
action=$(cat action.yml);
regex='docker:\/\/asyncapi\/github-action-for-cli:([0-9.]+)'

[[ $action =~ $regex ]]

action_version=${BASH_REMATCH[1]};

echo "Action version: $action_version";
echo "Package version: $version";

if [[ $action_version > $version ]]; then
echo "Action version is greater than package version";
else \
echo "Action version has not been bumped. Please bump the action version to the semantically correct version after $$version"; \
exit 1; \
fi

0 comments on commit 180ced3

Please sign in to comment.