Skip to content

Commit

Permalink
Documentation: Botonic qa/ci bash scripts #SER-2343 (#2530)
Browse files Browse the repository at this point in the history
<!-- _Set as [Draft
PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/) if
it's not ready to be merged_.

[PR best practices
Reference](https://blog.codeminer42.com/on-writing-a-great-pull-request-37c60ce6f31d/)
-->

## Description
Added documentation about the qa/ci scripts and its usage. Additionally,
fixed some minor errors or redundant Github Actions calls.
<!--
- Must be clear and concise (2-3 lines).
- Don't make reviewers think. The description should explain what has
been implemented or what it's used for. If a pull request is not
descriptive, people will be lazy or not willing to spend much time on
it.
- Be explicit with the names (don't abbreviate and don't use acronyms
that can lead to misleading understanding).
- If you consider it appropriate, include the steps to try the new
features.
-->

## Context
Check linear task
<!--
- What problem is trying to solve this pull request?
- What are the reasons or business goals of this implementation?
- Can I provide visual resources or links to understand better the
situation?
-->

## Approach taken / Explain the design
Understanding and reading each script and checking when or where is it
used.
<!--
- Explain what the code does.
- If it's a complex solution, try to provide a sketch.
-->
  • Loading branch information
Àlex Giménez Saludes authored Jun 19, 2023
1 parent 917713e commit 7077479
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 21 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/botonic-common-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ jobs:
- name: Verify lint
run: (cd ./packages/${{ inputs.PACKAGE }} && npm run lint_ci)

- name: Verify index.d.ts
run: scripts/qa/lint-d-ts.sh packages/${{ inputs.PACKAGE }}

- name: Publish Unit Test Results
if: ${{ inputs.PUBLISH_TESTS_RESULTS != '' && always() }}
uses: EnricoMi/publish-unit-test-result-action@v2
Expand Down
11 changes: 1 addition & 10 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,6 @@
"line_number": 26
}
],
"packages/botonic-cli/src/botonic-api-service.ts": [
{
"type": "Base64 High Entropy String",
"filename": "packages/botonic-cli/src/botonic-api-service.ts",
"hashed_secret": "24335a91ee41d6bbef10490becbdf3aa1843750b",
"is_verified": false,
"line_number": 23
}
],
"packages/botonic-cli/src/constants.ts": [
{
"type": "Base64 High Entropy String",
Expand All @@ -155,5 +146,5 @@
}
]
},
"generated_at": "2023-05-26T07:47:23Z"
"generated_at": "2023-06-15T13:16:36Z"
}
32 changes: 32 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,35 @@ Scripts for:
- Quality Assurance (QA)
- Continuous Integration (CI)
- Natural Language Understanding (NLU).

## Bash scripts

#### QA

- bump-version.sh:
- Use: This script has to be launched manually.
- Functionality: Bumps versions of Botonic packages to the inputed version. It affects the templates in `botonic-cli` and `botonic-react` and `botonic-plugin-nlu` , because updates the dependencies for packages pointing to other botonic projects.
- prepare-packages.sh:
- Use: This script has to be launched manually.
- Functionality: This script cleans the package `node_modules`, `lib` and `dist`. Then it reinstalls it, and also runs the build command. Finally, restarts the `eslint_d` plugin
- upgrade-deps.sh:
- Use: This script has to be launched manually.
- Functionality: This script stops eslint plugin, upgrades all the development dependencies for every package and finally restart the eslint plugin.

#### CI

- lint-d-ts.sh:
- Use: This script is used by two pre-commit hooks: botonic-core and botonic-react.
- Functionality: This script runs a linter on the .d.ts files of the selected package, without creating new files due to the `--noEmit`
- lint-package.sh:
- Use: This script is launched when changes are detected on any package in packages.
- Functionality: This scripts runs the npm run lint command. If the script detects that changes have been made, the script asks the user to perform two different git commands to check the changed files.
- lint-all-packages.sh:
- Use: This script has to be launched manually.
- Functionality: Runs for each package in packages, the lint-package.sh script.
- cloc-package.sh:
- Use: Used only by clock-all-packages.sh.
- Functionality: Counts all the lines of code (ignoring blankspaces and comments) of the package.
- cloc-all-packages.sh:
- Use: This script has to be launched manually.
- Functionality: Counts all the lines of code of each package in the packages folder.
2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"cloc-all": "./qa/cloc-all-packages.sh",
"lint-all": "./qa/lint-all-packages.sh",
"prepare-all": "./ci/prepare-package.sh",
"prepare-all": "./ci/prepare-packages.sh",
"publish-all": "BOTONIC_NO_INSTALL_ROOT_DEPENDENCIES=1 ts-node ./ci/publish.ts"
},
"keywords": [],
Expand Down
7 changes: 0 additions & 7 deletions scripts/qa/lint-d-ts.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#!/bin/bash
if [ "$GITHUB_ACTIONS" == "true" ]; then
echo 'Will skip tsc as it will run in separate workflow'
exit
else
echo "Will run tsc for package $1"
fi

BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"


Expand Down

0 comments on commit 7077479

Please sign in to comment.