Skip to content

Commit b6fdc66

Browse files
author
tatanus
committed
initial commit
1 parent 03adb49 commit b6fdc66

52 files changed

Lines changed: 15945 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
##########################################
2+
# code ownership
3+
##########################################
4+
5+
# default ownership:
6+
* @tatanus
7+

.github/FUNDING.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# These are supported funding model platforms
2+
3+
github: [tatanus] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
16+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: tatanus
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Download '...'
16+
2. Run '....'
17+
3. Select '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. Ubuntu MacOS]
28+
- Bash Version [e.g. 5.0]
29+
30+
**Additional context**
31+
Add any other context about the problem here.
32+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: tatanus
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.
21+

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Pull Request Template for the Bash_setup Project
2+
3+
## Description
4+
5+
Please provide a summary of the changes made, including:
6+
- The issue(s) fixed or the enhancement(s) added.
7+
- Relevant motivation and context for the change.
8+
- Any dependencies required for this update.
9+
10+
---
11+
12+
## Type of Change
13+
14+
Please select the type of change by marking the relevant option(s) with `[x]`:
15+
- [ ] Bug fix (non-breaking change that fixes an issue)
16+
- [ ] New feature (non-breaking change that adds functionality)
17+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
18+
- [ ] Documentation update (adds or modifies documentation)
19+
- [ ] Third-party dependency update (e.g., new tools, libraries, or resources)
20+
21+
---
22+
23+
## How Has This Been Tested?
24+
25+
Describe the tests you ran to verify your changes, including:
26+
1. Commands executed to validate the script's behavior.
27+
2. Environment details:
28+
- Operating System and version (e.g., Ubuntu 20.04, macOS Ventura).
29+
- Bash version (`bash --version`).
30+
- Any relevant configurations or dependencies used for testing.
31+
3. Test results:
32+
- Example input and output for the changes.
33+
34+
**Testing Checklist:**
35+
- [ ] Local testing with various edge cases and normal inputs.
36+
- [ ] Verified compatibility with related scripts/modules.
37+
- [ ] Reviewed logging outputs (if applicable).
38+
39+
---
40+
41+
## Screenshots (If Applicable)
42+
43+
If the changes involve user-facing functionality or outputs, please include **before and after screenshots** to help reviewers understand the impact of the change.
44+
45+
---
46+
47+
## Checklist
48+
49+
Please complete the checklist below to ensure your PR meets the project standards:
50+
51+
- [ ] I have run `shellcheck` using the repository's `.shellcheckrc` file to verify linting:
52+
```bash
53+
shellcheck --shell=bash --external-sources -x -S style -f gcc <your-script.sh>
54+
```
55+
- [ ] I have formatted all scripts using `shfmt`:
56+
```bash
57+
shfmt -i 4 -ci -bn -kp -sr -ln bash -d .
58+
```
59+
- [ ] I have verified that my changes are consistent with the project's [Style Guide](./STYLEGUIDE.md).
60+
- [ ] I have updated or added relevant tests (e.g., unit tests, test scripts).
61+
- [ ] All existing tests pass successfully after my changes.
62+
- [ ] I have added or updated documentation as needed, and linked any relevant PRs in related repositories (e.g., documentation or tools).
63+
- [ ] I have reviewed my own code for clarity and correctness.
64+
- [ ] I have commented on particularly complex or non-obvious parts of the code.
65+
66+
---
67+
68+
## Additional Notes
69+
70+
If your changes rely on external tools or third-party dependencies, please include details about:
71+
1. Why the tool/dependency is required.
72+
2. Links to relevant documentation or PRs in those third-party projects.
73+
74+
---
75+
76+
This PR template is designed to ensure contributions to the **bash_setup** project are clear, well-tested, and maintainable. Thank you for your contribution!
77+

.github/workflows/main.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Bash Project CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
name: Lint Bash Scripts with ShellCheck
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
# Checkout code
18+
- name: Checkout Code
19+
uses: actions/checkout@v3
20+
21+
# Install ShellCheck
22+
- name: Install ShellCheck
23+
run: |
24+
sudo apt update
25+
sudo apt install -y shellcheck
26+
27+
# Run ShellCheck on all scripts
28+
- name: Run ShellCheck
29+
run: |
30+
set -eo pipefail
31+
find . -name "*.sh" ! -path "./.git/*" -print0 | xargs -0 shellcheck --shell=bash --external-sources -x \
32+
--severity=style \
33+
--exclude=SC1090,SC1091,SC2034,SC2181
34+
35+
format:
36+
name: Check Formatting with shfmt
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
# Checkout code
41+
- name: Checkout Code
42+
uses: actions/checkout@v3
43+
44+
# Install shfmt
45+
- name: Install shfmt
46+
run: |
47+
sudo apt update
48+
sudo apt install -y shfmt
49+
50+
# Run shfmt to check formatting
51+
- name: Run shfmt
52+
run: |
53+
find . -type f -name "*.sh" -print0 | xargs -0 shfmt -i 4 -ci -bn -sr -kp -ln bash -d
54+
55+
# Explanation of flags:
56+
# ---------------------
57+
# -i 4 # Indent with 4 spaces (default is 2). Ensures consistent indentation style.
58+
# -ci # Indent `case` blocks (useful for readability within `case` statements).
59+
# -bn # Keep `do`, `then`, and similar keywords on the same line as the preceding command.
60+
# # Example: `if true; then` instead of splitting to `if true; \n then`.
61+
# -kp # Preserve padding in alignment for tables or comments (helps keep things visually aligned).
62+
# # Example:
63+
# # VAR1="value1" # aligned comment
64+
# # VAR2="value2"
65+
# -ln bash # Specify the shell dialect as `bash` (default is `posix` for maximum portability).
66+
# # Ensures proper parsing for Bash-specific features.
67+
# -d # Diff mode: Show differences between the current script formatting and the `shfmt` output.
68+
# # This is useful in CI pipelines or for dry runs to check formatting issues without modifying files.
69+
70+
# Notes:
71+
# - Remove the `-d` flag if you want shfmt to automatically apply formatting instead of displaying diffs.
72+
73+
validate_permissions:
74+
name: Validate File Permissions and Shebangs
75+
runs-on: ubuntu-latest
76+
77+
steps:
78+
# Checkout code
79+
- name: Checkout Code
80+
uses: actions/checkout@v3
81+
82+
# Ensure all shell scripts are executable
83+
- name: Ensure Executable Permissions
84+
run: |
85+
find . -name "*.sh" -exec chmod +x {} \;
86+
87+
# Validate all scripts have a shebang
88+
- name: Validate Shebangs
89+
run: |
90+
missing_shebangs=$(find . -name "*.sh" ! -path "./lib/common_core/*" ! -path "./dotfiles/bash-preexec.sh" ! -path "./another/ignored-file.sh" -exec sh -c 'head -n 1 "$1" | grep -q "^#!" || echo "Missing shebang: $1"' _ {} \;)
91+
if [[ -n "$missing_shebangs" ]]; then
92+
echo "The following files are missing a shebang:"
93+
echo "$missing_shebangs"
94+
exit 1
95+
fi
96+
97+
# run_bats_unit_tests:
98+
# name: Run BATS Unit Tests
99+
# runs-on: ubuntu-latest
100+
101+
# steps:
102+
# - name: Checkout Repository
103+
# uses: actions/checkout@v3
104+
105+
# # Install BATS if not included as a submodule
106+
# - name: Install BATS
107+
# run: |
108+
# sudo apt-get update
109+
# sudo apt-get install -y bats
110+
111+
# # Run the BATS Tests
112+
# - name: Run BATS Tests
113+
# run: |
114+
# bats tests/unit
115+

0 commit comments

Comments
 (0)