-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,093 additions
and
380 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
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 +1 @@ | ||
0.3.0 | ||
0.4.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
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,61 @@ | ||
#!/bin/bash | ||
|
||
declare SHIELDS='https://img.shields.io/static/v1' | ||
declare DEFAULT_COLOR='inactive' | ||
|
||
# init pathnames to badges | ||
badge_init() { | ||
local badge_name="${1}" | ||
local badge_default="${2}" #opt | ||
badge_generate "${badge_name}" "${badge_default:--}" | ||
# printf '' ... FIXME - Print badge URL | ||
} | ||
|
||
# % to colors | ||
percent_to_color() { | ||
declare color='brightgreen' | ||
declare perc="${1%\%}" | ||
(( 10#$perc < 85 )) \ | ||
&& color='green' | ||
(( 10#$perc < 70 )) \ | ||
&& color='yellow' | ||
(( 10#$perc < 55 )) \ | ||
&& color='orange' | ||
(( 10#$perc < 45 )) \ | ||
&& color='red' | ||
printf -- '%s\n' "${color}" | ||
} | ||
|
||
fraction_to_color() { | ||
if [[ "${1}" == */0 ]]; then | ||
printf '%s\n' "${DEFAULT_COLOR}" | ||
return 1 | ||
fi | ||
percent_to_color "$(( 100 * $1 ))" | ||
} | ||
|
||
# URL encoding | ||
url_encode() { | ||
jq -Rr @uri <<< "${1}" | ||
} | ||
|
||
# generate badge | ||
badge_generate() { | ||
local badge_name="${1}" | ||
local ci_job="${CI_JOB_NAME:-local}" | ||
local badge_file="${badge_name// /-}" | ||
badge_file="${RESULTS:-${WORKING_DIR}/.results}/badge-${ci_job}-${badge_file,,}.svg" | ||
local badge_label | ||
badge_label="$( url_encode "${badge_name}" )" | ||
local badge_value | ||
badge_value="$( url_encode "${2}" )" | ||
local badge_color="${3}" | ||
[[ -z "${badge_color}" ]] \ | ||
&& case "${2}" in | ||
n/a) badge_color="${DEFAULT_COLOR}";; | ||
*/*) badge_color="$( fraction_to_color "${2}" )";; | ||
*%) badge_color="$( percent_to_color "${2%\%}" )";; | ||
*) badge_color="${DEFAULT_COLOR}" | ||
esac | ||
curl -so "${badge_file}" "${SHIELDS}?label=${badge_label}&message=${badge_value}&color=${badge_color}" | ||
} |
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,21 @@ | ||
build-docker-image: | ||
image: docker:20.10.10 | ||
stage: build | ||
tags: | ||
- docker | ||
variables: | ||
DOCKER_HOST: tcp://dockerhost:2375/ | ||
DOCKER_DRIVER: overlay2 | ||
DOCKER_TLS_CERTDIR: "" | ||
services: | ||
- name: docker:20.10.10-dind | ||
alias: dockerhost | ||
script: | ||
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin | ||
- docker build --pull -t $CI_REGISTRY_IMAGE . | ||
- docker push $CI_REGISTRY_IMAGE | ||
rules: | ||
- changes: | ||
- Dockerfile | ||
- when: manual | ||
allow_failure: true |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
pages: | ||
stage: post-process | ||
script: | ||
- mkdir .public | ||
- cp -r ./* .public | ||
- rm -rf public | ||
- mv .public public | ||
artifacts: | ||
paths: | ||
- public | ||
rules: | ||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH |
Oops, something went wrong.