Skip to content

Commit

Permalink
Add release/coverage scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
d1ceward committed Aug 21, 2021
1 parent dfa360b commit 19e113d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
/lib/
/bin/
# Ignore crystal dependencies and generated binaries
/lib
/tmp

# Ignore binaries
/bin/*
!/bin/coverage
!/bin/release

# Ignore coverage files
/coverage
/run_tests.cr
/run_tests
12 changes: 12 additions & 0 deletions bin/coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail;
trap "exit" INT

echo "require \"./spec/**\"" > run_tests.cr

crystal build run_tests.cr -D skip-integration

kcov \
--clean \
--include-path=$(pwd)/src \
$(pwd)/coverage ./run_tests
33 changes: 33 additions & 0 deletions bin/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -eo pipefail;

release_func() {
if [[ $(git branch | grep \* | cut -d ' ' -f2) != "master" ]]; then
echo -e "\033[0;31m===>\033[0m Not on master branch !"
echo -e "\033[0;31m=>\033[0m Please change to master branch..."
exit 1;
fi

if ! $(git diff-index --quiet HEAD --); then
echo -e "\033[0;31m===>\033[0m Uncommitted changes !"
echo -e "\033[0;31m=>\033[0m Please commit changes before..."
exit 1;
fi

if [[ ! "${1}" ]]; then
echo -e "\033[0;31m===>\033[0m Need an version number !"
echo -e "\033[0;31m=>\033[0m Please give version like 8.10"
exit 1;
fi

sed -i "s/ VERSION = \".*/ VERSION = \"${1}\"/" src/xlsx-parser.cr
sed -i "0,/version: 0.*/s//version: 0.${1}/" shard.yml
git add src/xlsx-parser.cr shard.yml
git commit -m "Bump version number to v${1}"
git push origin master

git tag "v${1}"
git push --tags
}

release_func "${@}"
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
- D1ceWard <[email protected]>
description: Crystal wrapper for parsing .xlsx spreadsheets
license: MIT
crystal: '>= 0.36.0, < 2.0.0'
crystal: '>= 0.36.1, < 2.0.0'

development_dependencies:
ameba:
Expand Down

0 comments on commit 19e113d

Please sign in to comment.