Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New feat: tci(): tag to trigger the CI #21

Merged
merged 2 commits into from
May 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 101 additions & 67 deletions bashlava.sh
Original file line number Diff line number Diff line change
@@ -1,100 +1,121 @@
#!/usr/bin/env bash

### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
#
# To-Do comment section. Total of 15
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #

: '
// START COMMENT BLOCK
To-Do comment section. Total of 11

#4 TODO & backlog
#8 UX
#9 Bugfix
#10 Logic & Condition
#11 docs
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
PINNED issues on GH _
issue #4 TODO & backlog _
issue #8 UX _
issue #9 Bugfix _
issue #10 Logic & Condition _
issue #11 docs _
_
PR Title: New Feat:
Impact on: #4, #8, #9 #10
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

PR Title: 0o0o
Impact on: #4, #8, #9 #10, #11

# TODO New Feat dummy() create a dummy commit
TODO
PR Title: New feat: tci(): tag to trigger the CI
Impact on: #4, #8

- to quickly test bashlava in a dummy projet
- Impact on: #4, #8
- User facing
- Now, main_branch builds only when pushing tags
- Now, the CI do not build on every commits on main_branch (its a pain when we merge many PRs)
- Sometime we work directly on the main_branch (typically for CI work) and we dont want to trigger the CI pipeline


# TODO Core_Load_Vars_General
better management core vars / group them, avoid having multiple place to define them
file to check VERSUS file to source
TODO edge()
- dynamic edge name creation
- update path to ~/Library/Application Support/FirePress/bashlava

we have few array that are configs. They should be all together under the same block of code.
source files under /components
code optimization 0o0o / Need logic to manage file under /private/*
favorite URL could be a great example

set a new config flag: debug="true"
TODO log()
- see 4 line instead of 1
- adapt log() to see 10 instead of 8
- Impact on: #4, #8


TODO Core_Load_Vars_General
- better management core vars / group them, avoid having multiple place to define them
- file to check VERSUS file to source
- we have few array that are configs. They should be all together under the same block of code.


# TODO private scripts
TODO private scripts

logical flags to manage under /private/*
source {_path_components}/private/
Need to check if files exist /private/* when DIR private exist
manage private vars https://github.com/firepress-org/bashlava/issues/83;

logic to switch between private fct VERSUS public fct
custom_fct_opensite="false"
custom_fct_help="false"
this will use a fct available to public
else it will use a
Need logic to manage file under /private/* fct VERSUS public fct

overide like:
- favorite URL
- custom_fct_opensite="true" # during pr, merg
- custom_fct_help="false"
- set a new config flag: debug="true"

TODO
## App if app are installed
which git-crypt
which gnupg
which shellcheck
which openssl
which sha256

if not propose to install them via brew

# TODO
## App check brew + git-crypt + gnupg, shellcheck
if brew ls --versions myformula > /dev/null; then
The package is installed
else
The package is not installed
fi

# TODO
spell checker in comments, vs code extension ?

TODO ci pipeline
- superlinter (includes shellcheck)
- create ci for using shellcheck
- run test()


# TODO
when the user goes into a prompt, he should be able to provide attri to avoid the pop-up.
ex: ci yes, ci no
ex: show app, show 3
need to check if gh cli support this as well
TODO
edge() prompt user
- Impact on: #4, #8

OPTIONS ARE:
1) CREATE edge_neW and DELETE edge_olD (default)
2) CREATE edge_neW and KEEP edge_olD
3) CREATE custom_neW and DELETE edge_olD only
4) CREATE custom_neW and KEEP edge_olD only

# TODO ci pipeline
create ci for using shellcheck
run test()
(Your branch name for edge is located .. path here )


# TODO Show_Docs()
TODO Show_Docs()
works but not clean, but it works mdv() / Show_Docs
we cant provide an abosolute path to the file because the Docker container cant the absolute path
I also DONT want to provide two arguments when using glow
I might simply stop using a docker container for this
but as a priciiple, I like to call a docker container

# TODO squash
function that search for the same commit messages in previous commits
then suggestion to do a squash, then prompt user y/n

TODO squash
- function that search for the same commit messages in previous commits
- then suggestion to do a squash, then prompt user y/n

# TODO Show_Fct_Category_F1 , F2
revisit this function once all file are solid + private logic

TODO Show_Fct_Category_F1 , F2
- revisit this function once all file are solid + private logic

# TODO
idea_here

# TODO
idea_here
TODO RANDOM NOTES
- multipass.run / shell
- var subtitution example
- GH enviroment (staging, prod)
- re-use workflow
- List files on B2

// END COMMENT BLOCK
'
Expand Down Expand Up @@ -229,8 +250,6 @@ function mrg { # User_

gh pr merge

echo "wip" > /dev/null 2>&1

# Ensure to checkout to main_branch.
# The user maybe did not deleted the PR branch in the previous step (via cli gh pr merge)
_branch_exist=$(git branch --list "${default_branch}" | wc -l)
Expand Down Expand Up @@ -327,6 +346,21 @@ function tag { # User_
esac
}

function tci { # User_
Condition_No_Commits_Pending
Condition_Attr_2_Must_Be_Empty

_short_hash=$(git rev-parse --short HEAD)
_tag_name="ci_${app_version}_${_short_hash}"
_var_name="_short_hash" _is_it_empty="${_short_hash}" && Condition_Vars_Must_Be_Not_Empty
_var_name="_tag_name" _is_it_empty="${_tag_name}" && Condition_Vars_Must_Be_Not_Empty

git tag ${_tag_name} && git push --tags && echo
Show_Version

# For docs, see this PR: 0o0o
}

function release { # User_
Condition_No_Commits_Pending
Condition_Attr_2_Must_Be_Empty
Expand Down Expand Up @@ -355,13 +389,10 @@ function squash { # User_
my_message="Oups, syntax error." && Print_Warning_Stop
fi

git reset --hard HEAD~"${input_2}"
git merge --squash HEAD@{1}
git push origin HEAD --force
git status
git add -A
git commit -m "${input_3}"
git push
git reset --soft HEAD~"${input_2}" &&\
git commit --edit -m "${input_3}" &&\
git push --force-with-lease &&\
git pull &&\
log
}

Expand Down Expand Up @@ -390,10 +421,13 @@ function ci { # User_
}

function dummy { # User_
write_dummy_commit_here="README.md"
echo "Dummy Commit ${date_sec}" >> "${write_dummy_commit_here}"
git add -A && git commit -m "Dummy Commit ${date_sec}" && git push
pr
_in_file="README.md"
_hash=$(echo ${date_nano} | sha256sum | awk '{print $1}')
_hash_four_last="${_hash: -4}"

echo "Dummy Commit, ${date_sec}, ${_hash}" >> "${_in_file}"
git add -A && git commit -m "dummy commit ${_hash_four_last}" && git push
log
}

function show { # User_
Expand Down