Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass authored Sep 17, 2024
0 parents commit 20e2e77
Show file tree
Hide file tree
Showing 28 changed files with 663 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[**.sh]
max_line_length = 120

[**.md]
indent_size = 2

[{Makefile,**.mk,.git*}]
indent_style = tab

[{lib/*,README.md}]
indent_size = unset

[{tests/acceptance/**.sh,src/console_header.sh}]
indent_size = unset

[tests/**/*.snapshot]
indent_size = unset
max_line_length = unset
trim_trailing_whitespace = false

[bin/*]
charset = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_style = unset
indent_size = unset
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# bashunit
BASHUNIT_DEFAULT_PATH="tests"
BASHUNIT_TESTS_ENV="tests/helpers.sh"
41 changes: 41 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we
pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level
of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size,
race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
* Other unethical or unprofessional conduct

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these
principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the
project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer
at chemaclass@outlook.es. All complaints will be reviewed and investigated and will result in a response that is deemed
necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the
reporter of an incident.

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.3.0, available
at [https://contributor-covenant.org/version/1/3/0/][version]

[homepage]: https://contributor-covenant.org

[version]: https://contributor-covenant.org/version/1/3/0/
120 changes: 120 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Contributing

## We have a Code of Conduct

Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.

## Any contributions you make will be under the MIT License

When you submit code changes, your submissions are understood to be under the
same [MIT](../LICENSE) that covers the project. By contributing to this
project, you agree that your contributions will be licensed under its MIT.

## Write bug reports with detail, background, and sample code

In your bug report, please provide the following:

* A quick summary and/or background
* Steps to reproduce
* Be specific!
* Give sample code if you can.
* What you expected would happen
* What actually happens
* Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)

Please post code and output as text ([using proper markup](https://guides.github.com/features/mastering-markdown/)).
Additional screenshots to help contextualize behavior are ok.

## Workflow for Pull Requests

1. Fork/clone the repository.
2. Create your branch from `main` if you plan to implement new functionality or change existing code significantly.
3. Implement your change and add tests for it.
4. Ensure the test suite passes.
5. Ensure the code complies with our coding guidelines (see below).
6. Send that pull request!

Please make sure you have [set up your username and email address](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for
use with Git. Strings such as `silly nick name <root@localhost>` looks bad in the commit history of a project.


---

## Development

- Entry point `main`
- Isolated testable functions inside files under the `src` directory

### Build

You can build the whole project into a single executable script combining all files from src and the entry point.

```bash
./build.sh
```

## Testing

Install dependencies: `./install-dependencies.sh`

Run tests:

```bash
# using make
make test

# using bashunit directly
lib/bashunit tests
```

## Coding Guidelines

### ShellCheck

To contribute to this repository you must have [ShellCheck](https://github.com/koalaman/shellcheck) installed on your
local machine or IDE, since it is the static code analyzer that is being used in continuous integration pipelines.

Installation: https://github.com/koalaman/shellcheck#installing

#### Example of usage

```bash
# using make
make sa

# using ShellCheck itself
shellcheck ./**/**/*.sh -C
```

### editorconfig-checker

To contribute to this repository, consider installing [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker)
to check all project files regarding the `.editorconfig` to ensure we all fulfill the standard.

Installation: https://github.com/editorconfig-checker/editorconfig-checker#installation

To run it, use the following command:

```bash
# using make
make lint

# using editorconfig-checker itself
ec -config .editorconfig
```

This command will be executed on the CI to ensure the project's quality standards.

#### We recommend

To install the pre-commit of the project with the following command:

**Please note that you will need to have ShellCheck and editorconfig-checker installed on your computer.**
See above how to install in your local.

```bash
make pre_commit/install
```

[Shell Guide](https://google.github.io/styleguide/shellguide.html#s7.2-variable-names) by Google Conventions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ["https://chemaclass.com/sponsor"]
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### 🔗 Ticket

{{ TICKET_LINK }}

## 🤔 Background

<!-- {{ BACKGROUND }} -->

## 💡 Goal

<!-- The goal of this PR. -->

## 🔖 Changes

<!-- List individual changes in more detail as you might consider them important. -->

## 🖼️ Screenshots

<!-- Consider adding BEFORE and AFTER screenshots. -->

#### BEFORE

#### AFTER
9 changes: 9 additions & 0 deletions .github/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Release

This is a guide to know the steps to create a new release.

1. Update the version in [BASH_SKELETON_VERSION](../entry-point)
1. Update the version in [CHANGELOG.md](../CHANGELOG.md)
1. Build the project `./build.sh bin` - This generates `bin/main` & `bin/checksum`
1. Create a [new release](https://github.com/Chemaclass/bash-skeleton/releases/new) from GitHub
1. Attach `bin/main` and `bin/checksum` to the release
24 changes: 24 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Editorconfig Linter

on:
pull_request:
push:
branches:
- main

jobs:
linter:
name: "Run Lint on ${{ matrix.os }}"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Editorconfig Linter
uses: editorconfig-checker/action-editorconfig-checker@main

- name: Run Linter
run: editorconfig-checker

28 changes: 28 additions & 0 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Static Analysis

on:
pull_request:
push:
branches:
- main

jobs:
shellcheck:
name: ShellCheck
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC1091 -e SC2155

34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests

on:
pull_request:
push:
branches:
- main

jobs:
tests:
name: "Run tests on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
include:
- os: ubuntu-latest
script_name: 'make test'
- os: macos-latest
script_name: 'make test'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Install bashunit"
run: "./install-dependencies.sh"

- name: Run Tests
run: ${{ matrix.script_name }}

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bin/
lib/
.idea/
.vscode/
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## [0.1](https://github.com/Chemaclass/bash-skeleton/compare/main...0.1) - 2024-09-15

Initial release. Check README for instructions about installation and how to use it.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Jose M. Valera Reales

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 20e2e77

Please sign in to comment.