Compare commits

..

5 Commits

Author SHA1 Message Date
Rick Barenthin
4dc7ec53e3 ci(pipeline): add version and changelog update to pipeline
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-01 22:57:46 +02:00
Rick Barenthin
183ddb8f3c build(image): add missing build image Dockerfile.build 2022-06-01 22:56:26 +02:00
Rick Barenthin
d540470e58 build(conventi): update conventi.sh for correct newlines 2022-06-01 22:55:32 +02:00
Rick Barenthin
0bd7bfc494 build(conventi): updated conventi.sh fancy changelog 2022-06-01 21:23:48 +02:00
Rick Barenthin
7e46ba3751 feat(build): add Dockerfile for conventi.sh 2022-06-01 21:03:34 +02:00
4 changed files with 105 additions and 35 deletions

View File

@ -4,26 +4,73 @@ type: docker
name: main name: main
steps: steps:
- name: Tag commit - name: fetch tags
image: alpine image: alpine/git
commands: commands:
- echo This would create a tag - git fetch --tags
- name: update version and changelog
image: registry.riba-interactive.de/conventi:1
- name: commit changelog updates
image: alpine/git
commands:
- git add .
- git commit -m "[CI SKIP] version and changelog update"
- name: tag commit
image: registry.riba-interactive.de/conventi:1
commands:
- export version=$(conventi.sh get_version)
- git tag -am "Tagging new version $version" "$version"
- git push origin "$version"
trigger: trigger:
branch: branch:
- main - main
event:
- push
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: develop name: tag
steps: steps:
- name: Tag commit - name: Build release
image: registry.riba-interactive.de/alpine-build:1
commands:
- cmake -S. -Bcmake-build-ci -DCMAKE_BUILD_TYPE=Release
- cd cmake-build-ci
- cmake --build .
- echo "Done"
trigger:
event:
- tag
---
kind: pipeline
type: docker
name: Build and Test
steps:
- name: Build and run tests
image: registry.riba-interactive.de/alpine-build:1
commands:
- cmake -S. -Bcmake-build-ci -DCMAKE_BUILD_TYPE=Debug -DENABLE_TEST_COVERAGE=on
- cd cmake-build-ci
- cmake --build .
- ctest -T Test -T Coverage
- name: Report test and coverage
image: alpine image: alpine
commands: commands:
- echo This would build the app and run test - echo "Do some curl or so"
when:
event:
- pull_request
trigger: trigger:
branch: branch:
- develop - develop
- feature/*
image_pull_secrets:
- dockerconfig
... ...

7
build/Dockerfile.build Normal file
View File

@ -0,0 +1,7 @@
FROM alpine:3.16.0
RUN apk --no-cache add \
bison \
build-base \
cmake \
flex

13
build/conventi/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM alpine:3.16.0
RUN apk --no-cache add \
git \
jq
COPY conventi.sh /usr/local/bin/
VOLUME /conventi
WORKDIR /conventi
ENTRYPOINT ["/usr/local/bin/conventi.sh"]
CMD [""]

View File

@ -230,39 +230,39 @@ add_changelog_entry_line() {
;; ;;
build) build)
build_lines="$build_lines\n* $2\n" build_lines=$(printf '%s\n* %s\n' "$build_lines" "$2")
;; ;;
chore) chore)
chore_lines="$chore_lines\n* $2\n" chore_lines=$(printf '%s\n* %s\n' "$chore_lines" "$2")
;; ;;
ci) ci)
ci_lines="$ci_lines\n* $2\n" ci_lines=$(printf '%s\n* %s\n' "$ci_lines" "$2")
;; ;;
doc_lines) doc_lines)
doc_lines="$doc_lines\n* $2\n" doc_lines=$(printf '%s\n* %s\n' "$doc_lines" "$2")
;; ;;
style) style)
style_lines="$style_lines\n* $2\n" style_lines=$(printf '%s\n* %s\n' "$style_lines" "$2")
;; ;;
refactor) refactor)
refactor_lines="$refactor_lines\n* $2\n" refactor_lines=$(printf '%s\n* %s\n' "$refactor_lines" "$2")
;; ;;
perf) perf)
perf_lines="$perf_lines\n* $2\n" perf_lines=$(printf '%s\n* %s\n' "$perf_lines" "$2")
;; ;;
test) test)
test_lines="$test_lines\n* $2\n" test_lines=$(printf '%s\n* %s\n' "$test_lines" "$2")
;; ;;
revert) revert)
revert_lines="$revert_lines\n* $2\n" revert_lines=$(printf '%s\n* %s\n' "$revert_lines" "$2")
;; ;;
esac esac
} }
@ -270,44 +270,43 @@ add_changelog_entry_line() {
format_entry() { format_entry() {
entry="" entry=""
if [ -n "$breaking_change_lines" ]; then if [ -n "$breaking_change_lines" ]; then
entry="$entry### BREAKING CHANGES\n$breaking_change_lines\n\n" entry=$(printf '%s\n\n\n### BREAKING CHANGES 🚨\n%s\n' "$entry" "$breaking_change_lines")
fi fi
if [ -n "$bugfix_lines" ]; then if [ -n "$bugfix_lines" ]; then
entry="$entry### Bug fixes\n$bugfix_lines\n\n" entry=$(printf '%s\n\n\n### Bug fixes 🩹\n%s\n' "$entry" "$bugfix_lines")
fi fi
if [ -n "$feature_lines" ]; then if [ -n "$feature_lines" ]; then
#entry="$entry### Features\n$feature_lines\n\n" entry=$(printf '%s\n\n\n### Features 📦\n%s\n' "$entry" "$feature_lines")
entry=$(printf '%s### Features\n%s\n\n' "$entry" "$feature_lines")
fi fi
if [ -n "$revert_lines" ]; then if [ -n "$revert_lines" ]; then
entry="$entry### Reverts\n$revert_lines\n\n" entry=$(printf '%s\n\n\n### Reverts 🔙\n%s\n' "$entry" "$revert_lines")
fi fi
if [ -n "$build_lines" ]; then if [ -n "$build_lines" ]; then
entry="$entry### Build System\n$build_lines\n\n" entry=$(printf '%s\n\n\n### Build System 🏗\n%s\n' "$entry" "$build_lines")
fi fi
if [ -n "$chore_lines" ]; then if [ -n "$chore_lines" ]; then
entry="$entry### Chores\n$chore_lines\n\n" entry=$(printf '%s\n\n\n### Chores 🧽\n%s\n' "$entry" "$chore_lines")
fi fi
if [ -n "$ci_lines" ]; then if [ -n "$ci_lines" ]; then
entry="$entry### CIs\n$ci_lines\n\n" entry=$(printf '%s\n\n\n### CIs ⚙️\n%s\n' "$entry" "$ci_lines")
fi fi
if [ -n "$doc_lines" ]; then if [ -n "$doc_lines" ]; then
entry="$entry### Docs\n$doc_lines\n\n" entry=$(printf '%s\n\n\n### Docs 📑\n%s\n' "$entry" "$doc_lines")
fi fi
if [ -n "$test_lines" ]; then if [ -n "$test_lines" ]; then
entry="$entry### Tests\n$test_lines\n\n" entry=$(printf '%s\n\n\n### Tests 🧪\n%s\n' "$entry" "$test_lines")
fi fi
if [ -n "$style_lines" ]; then if [ -n "$style_lines" ]; then
entry="$entry### Styles\n$style_lines\n\n" entry=$(printf '%s\n\n\n### Styles 🖼\n%s\n' "$entry" "$style_lines")
fi fi
if [ -n "$refactor_lines" ]; then if [ -n "$refactor_lines" ]; then
entry="$entry### Refactors\n$refactor_lines\n\n" entry=$(printf '%s\n\n\n### Refactors 🛠\n%s\n' "$entry" "$refactor_lines")
fi fi
if [ -n "$perf_lines" ]; then if [ -n "$perf_lines" ]; then
entry="$entry### Perfs\n$perf_lines\n\n" entry=$(printf '%s\n\n\n### Performance 🏎\n%s\n' "$entry" "$perf_lines")
fi fi
if [ -n "$entry" ]; then if [ -n "$entry" ]; then
entry="## [$version]($(get_config_url)/compare/$from_hash...$to_hash) ($(date '+%Y-%m-%d'))\n\n\n$entry" entry=$(printf '## [%s](%s/compare/%s...%s) (%s)%s' "$version" "$(get_config_url)" "$from_hash" "$to_hash" "$(date '+%Y-%m-%d')" "$entry")
fi fi
echo "$entry" echo "$entry"
} }
@ -339,13 +338,17 @@ generate_changelog_entry() {
line=$(format_entry_line "$description" "$scope" "$hash") line=$(format_entry_line "$description" "$scope" "$hash")
if [ "$is_breaking" -eq 1 ] && [ -z "$breaking_change" ]; then if [ "$is_breaking" -eq 1 ] && [ -z "$breaking_change" ]; then
if [ -n "$body" ]; then
breaking_change="$body" breaking_change="$body"
else
breaking_change="$description"
fi
fi fi
if [ "$is_breaking" -eq 1 ]; then if [ "$is_breaking" -eq 1 ]; then
is_major=1 is_major=1
breaking_change=$(echo "$breaking_change" | sed -e '2,$s/^[ ]*/ /') breaking_change=$(echo "$breaking_change" | sed -e '2,$s/^[ ]*/ /')
breaking_change_lines="$breaking_change_lines\n* $breaking_change\n" breaking_change_lines=$(printf '%s\n* %s\n' "$breaking_change_lines" "$breaking_change")
fi fi
case "$type" in case "$type" in
@ -386,9 +389,9 @@ new_changelog_entry() {
changelog=$(sed -n '/^----/,//{/^----/!p;}' <$changelog_file) changelog=$(sed -n '/^----/,//{/^----/!p;}' <$changelog_file)
if [ -n "$changelog" ]; then if [ -n "$changelog" ]; then
changelog="$changelog_header\n$entry\n$changelog" changelog=$(printf '%s\n%s\n%s' "$changelog_header" "$entry" "$changelog")
else else
changelog="$changelog_header\n$entry" changelog=$(printf '%s\n%s' "$changelog_header" "$entry")
fi fi
echo "$changelog" >$changelog_file echo "$changelog" >$changelog_file
} }