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

Bash compiler #45

Merged
merged 24 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d93bf99
compiled installRequirements using go compiler
fchastanet Aug 26, 2024
723175d
compiled doc using go compiler
fchastanet Aug 26, 2024
67c279d
compiled install using go compiler
fchastanet Aug 26, 2024
092bcb3
compiled mysql2puml using go compiler
fchastanet Aug 26, 2024
b038877
compiled dbImport using go compiler
fchastanet Aug 31, 2024
b2bbc60
compiled dbImportProfile using go compiler
fchastanet Aug 31, 2024
f2874dd
compiled dbImportStream using go compiler
fchastanet Aug 31, 2024
fd7c77d
compiled dbQueryAllDatabases using go compiler
fchastanet Sep 1, 2024
26e783a
compiled dbScriptAllDatabases using go compiler
fchastanet Sep 1, 2024
2385553
compiled extractData using go compiler
fchastanet Sep 1, 2024
fdf4589
compiled cli using go compiler
fchastanet Sep 1, 2024
9ebab6b
renamed binary-*.yaml files to *-binary.yaml
fchastanet Sep 3, 2024
c2fb038
compiled gitIsAncestorOf using go compiler
fchastanet Sep 3, 2024
d9f80f1
compiled gitIsBranch using go compiler
fchastanet Sep 3, 2024
d7cb815
compiled gitRenameBranch using go compiler
fchastanet Sep 4, 2024
bb01c30
compiled upgradeGithubRelease using go compiler
fchastanet Sep 7, 2024
0ab09ec
compiled waitForIt using go compiler
fchastanet Sep 7, 2024
2bd43f7
compiled waitForMysql using go compiler
fchastanet Sep 7, 2024
a43bd94
compiled postmanCli using go compiler
fchastanet Sep 7, 2024
469c1ca
Refactoring to remove duplicated code
fchastanet Sep 8, 2024
5ef39ae
update binaries template using authorizedValues
fchastanet Sep 15, 2024
82c8c15
pre-commit btf 5.1.3, bash-compiler 0.3.6
fchastanet Sep 15, 2024
35e547e
github pipeline use megalinter v8
fchastanet Sep 16, 2024
a76c8a6
use bash-compiler v1.0.0
fchastanet Sep 21, 2024
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
2 changes: 2 additions & 0 deletions .bash-compiler
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FRAMEWORK_ROOT_DIR=${ROOT_DIR}/vendor/bash-tools-framework
BASH_TOOLS_ROOT_DIR=${ROOT_DIR}
2 changes: 1 addition & 1 deletion .framework-config
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ FRAMEWORK_FUNCTIONS_IGNORE_REGEXP="${FRAMEWORK_FUNCTIONS_IGNORE_REGEXP:-^(Namesp
# describe the files that do not contain function to be imported
NON_FRAMEWORK_FILES_REGEXP="${NON_FRAMEWORK_FILES_REGEXP:-(^bin/|\.framework-config|^test\.sh$|^\.github/preCommitGeneration\.sh$|^install$|\.bats$|/testsData/|^manualTests/|/_\.sh$|/ZZZ\.sh$|/__all\.sh$|^src/_binaries|^src/_includes|^src/batsHeaders\.sh$|^conf/)}"
# describe the files that are allowed to not have an associated bats file
BATS_FILE_NOT_NEEDED_REGEXP="${BATS_FILE_NOT_NEEDED_REGEXP:-(^conf/|^bin/|^\.github/preCommitGeneration\.sh$|.framework-config|^install$|\.bats$|/testsData/|^manualTests/|/_\.sh$|/ZZZ\.sh$|/__all\.sh$|^src/batsHeaders\.sh$|^src/_includes)}"
BATS_FILE_NOT_NEEDED_REGEXP="${BATS_FILE_NOT_NEEDED_REGEXP:-(^conf/|^bin/|^\.github/preCommitGeneration\.sh$|.framework-config|^install$|\.bats$|/testsData/|^manualTests/|/_\.sh$|/ZZZ\.sh$|/__all\.sh$|^src/batsHeaders\.sh$|^src/_includes|^src/_binaries/.*-(options|main)\.sh$|^conf/|^src/_binaries/commandDefinitions/options.*\.sh$|/testsData/|^test\.sh$)}"
# describe the files that are allowed to not have a function matching the filename
FRAMEWORK_FILES_FUNCTION_MATCHING_IGNORE_REGEXP="${FRAMEWORK_FILES_FUNCTION_MATCHING_IGNORE_REGEXP:-^conf/|^bin/|^\.framework-config$|\.tpl$|testsData/binaryFile$}"
# Source directories
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
if: ${{ always() }}
# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter/flavors/terraform@v7
uses: oxsecurity/megalinter/flavors/terraform@v8
# All available variables are described in documentation
# https://megalinter.io/configuration/
env:
Expand Down
1 change: 1 addition & 0 deletions .jscpd.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"conf/postmanCli/GithubAPI/GitHubAPI-01-Basic_no_auth_postman_collection.json",
"conf/postmanCli/GithubAPI/GitHubAPI-02-Advanced_with_auth_postman_collection.json",
"src/_binaries/DbImport/dbImportProfile.options.tpl",
"src/_binaries/Database/dbImport/dbImport-options.sh",
"**/snippets/**"
]
}
26 changes: 17 additions & 9 deletions .pre-commit-config-github.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ repos:
)$

- repo: https://github.com/rhysd/actionlint
rev: v1.6.27
rev: v1.7.1
hooks:
- id: actionlint
stages: [pre-commit, pre-push, manual]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args:
Expand All @@ -127,8 +127,8 @@ repos:
^.cspell/codespellrc-.*.txt$
)

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.3.3
hooks:
- id: prettier
exclude: |
Expand Down Expand Up @@ -161,19 +161,17 @@ repos:
exclude: /testsData/

- repo: https://github.com/fchastanet/bash-tools-framework
rev: 4.0.0
rev: 6.0.0
hooks:
- id: fixShebangExecutionBit
- id: awkLint
- id: buildShFiles
- id: buildShFilesGithubAction
- id: shellcheckLint
- id: shellcheckLintGithubAction
- id: frameworkLint
args:
[
--expected-warnings-count,
"6",
"5",
--format,
plain,
--theme,
Expand All @@ -185,7 +183,7 @@ repos:
args:
[
--expected-warnings-count,
"6",
"5",
--format,
checkstyle,
--theme,
Expand All @@ -194,6 +192,11 @@ repos:
WARNING,
]
- id: plantuml
args: [--same-dir, -f, png, -f, svg, --limit-size, "1200"]
exclude: |
(?x)(
^conf/mysql2pumlSkins/default.puml$
)

- repo: local
hooks:
Expand All @@ -205,3 +208,8 @@ repos:
pass_filenames: false
require_serial: true
stages: [manual] # GITHUB

- repo: https://github.com/fchastanet/bash-compiler
rev: v1.0.0
hooks:
- id: buildBashBinaries
26 changes: 17 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ repos:
)$

- repo: https://github.com/rhysd/actionlint
rev: v1.6.27
rev: v1.7.1
hooks:
- id: actionlint
stages: [pre-commit, pre-push, manual]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args:
Expand All @@ -122,8 +122,8 @@ repos:
^.cspell/codespellrc-.*.txt$
)

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.3.3
hooks:
- id: prettier
exclude: |
Expand Down Expand Up @@ -156,19 +156,17 @@ repos:
exclude: /testsData/

- repo: https://github.com/fchastanet/bash-tools-framework
rev: 4.0.0
rev: 6.0.0
hooks:
- id: fixShebangExecutionBit
- id: awkLint
- id: buildShFiles
- id: buildShFilesGithubAction
- id: shellcheckLint
- id: shellcheckLintGithubAction
- id: frameworkLint
args:
[
--expected-warnings-count,
"6",
"5",
--format,
plain,
--theme,
Expand All @@ -180,7 +178,7 @@ repos:
args:
[
--expected-warnings-count,
"6",
"5",
--format,
checkstyle,
--theme,
Expand All @@ -189,6 +187,11 @@ repos:
WARNING,
]
- id: plantuml
args: [--same-dir, -f, png, -f, svg, --limit-size, "1200"]
exclude: |
(?x)(
^conf/mysql2pumlSkins/default.puml$
)

- repo: local
hooks:
Expand All @@ -200,3 +203,8 @@ repos:
pass_filenames: false
require_serial: true
stages: [] # GITHUB

- repo: https://github.com/fchastanet/bash-compiler
rev: v1.0.0
hooks:
- id: buildBashBinaries
4 changes: 4 additions & 0 deletions .v8rrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ customCatalog:
description: pre-commit
fileMatch: [".pre-commit-config*.yml", ".pre-commit-config*.yaml"]
location: https://json.schemastore.org/pre-commit-config.json
- name: eslint-json
description: eslint-json
fileMatch: [".eslintrc-json.json"]
location: https://json.schemastore.org/eslintrc.json
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
"name": "Bash-Debug (generic)",
"program": "${file}"
},
{
"type": "bashdb",
"request": "launch",
"name": "dbQueryAllDatabases",
"program": "bin/dbQueryAllDatabases",
"args": ["-f", "ckls.local"]
},
{
"type": "bashdb",
"request": "launch",
Expand Down
23 changes: 15 additions & 8 deletions Commands.tmpl.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# The commands

- [1. Build tools](#1-build-tools)
- [1.1. bin/installRequirements](#11-bininstallrequirements)
- [1.2. bin/waitForIt](#12-binwaitforit)
- [1.3. bin/waitForMysql](#13-binwaitformysql)
- [1.4. bin/doc](#14-bindoc)
- [1.1. bin/install](#11-bininstall)
- [1.2. bin/installRequirements](#12-bininstallrequirements)
- [1.3. bin/waitForIt](#13-binwaitforit)
- [1.4. bin/waitForMysql](#14-binwaitformysql)
- [1.5. bin/doc](#15-bindoc)
- [2. Converter and Generator tools](#2-converter-and-generator-tools)
- [2.1. bin/mysql2puml](#21-binmysql2puml)
- [2.1.1. Help](#211-help)
Expand Down Expand Up @@ -36,25 +37,31 @@

## 1. Build tools

### 1.1. bin/installRequirements
### 1.1. bin/install

```text
@@@install_help@@@
```

### 1.2. bin/installRequirements

```text
@@@installRequirements_help@@@
```

### 1.2. bin/waitForIt
### 1.3. bin/waitForIt

```text
@@@waitForIt_help@@@
```

### 1.3. bin/waitForMysql
### 1.4. bin/waitForMysql

```text
@@@waitForMysql_help@@@
```

### 1.4. bin/doc
### 1.5. bin/doc

```text
@@@doc_help@@@
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- [3. Development Environment](#3-development-environment)
- [3.1. build dependencies](#31-build-dependencies)
- [3.2. Precommit hook](#32-precommit-hook)
- [Compile binaries](#compile-binaries)
- [3.3. UT](#33-ut)
- [3.4. auto generated bash doc](#34-auto-generated-bash-doc)
- [3.5. github page](#35-github-page)
Expand Down Expand Up @@ -150,6 +151,14 @@ You also have to execute the following command to enable it:
pre-commit install --hook-type pre-commit --hook-type pre-push
```

### Compile binaries

```bash
export FRAMEWORK_ROOT_DIR=/home/wsl/fchastanet/bash-tools/vendor/bash-tools-framework
export BASH_TOOLS_ROOT_DIR=/home/wsl/fchastanet/bash-tools
go run ./cmd/bash-compiler $(find "${BASH_TOOLS_ROOT_DIR}/src/_binaries" -name '*-binary.yaml' -print)
```

### 3.3. UT

All the commands are unit tested, you can run the unit tests using the following
Expand Down
Loading