-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add CI/CD workflows, clang-format, and clang-tidy #21
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e4a0fc7
feat: add CI/CD workflows, clang-format, and clang-tidy configs
melogtm 869c920
Potential fix for pull request finding
melogtm 6889712
Potential fix for pull request finding
melogtm bbb4545
Potential fix for pull request finding
melogtm b823df1
Potential fix for pull request finding
melogtm 8910dc9
Potential fix for pull request finding
melogtm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| BasedOnStyle: LLVM | ||
| IndentWidth: 4 | ||
| ColumnLimit: 100 | ||
| AllowShortIfStatementsOnASingleLine: false | ||
| AllowShortLoopsOnASingleLine: false | ||
| BreakBeforeBraces: Attach | ||
| PointerAlignment: Right | ||
| SpaceAfterCStyleCast: true | ||
| SpaceBeforeParens: ControlStatements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| Checks: > | ||
| bugprone-*, | ||
| clang-analyzer-*, | ||
| performance-*, | ||
| portability-*, | ||
| readability-*, | ||
| -readability-identifier-length, | ||
| -readability-magic-numbers, | ||
| -readability-isolate-declaration, | ||
| -readability-function-cognitive-complexity, | ||
| -bugprone-multi-level-implicit-pointer-conversion, | ||
| -bugprone-easily-swappable-parameters, | ||
| -bugprone-branch-clone, | ||
| -bugprone-implicit-widening-of-multiplication-result, | ||
| -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, | ||
| -clang-analyzer-core.NonNullParamChecker, | ||
| -clang-analyzer-security.ArrayBound, | ||
| -clang-analyzer-unix.StdCLibraryFunctions, | ||
| -clang-analyzer-core.NullDereference | ||
| WarningsAsErrors: '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install cmake | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake | ||
| - name: Build and test | ||
| run: ./run_tests.sh | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install lint tools | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y clang-format clang-tidy | ||
| - name: clang-format (dry-run) | ||
| run: | | ||
| clang-format --dry-run --Werror $(find src include tests -name '*.c' -o -name '*.h') | ||
| - name: Configure for clang-tidy | ||
| run: cmake -B cmake-build-debug -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | ||
| - name: clang-tidy | ||
| run: | | ||
| clang-tidy -p cmake-build-debug -warnings-as-errors=* $(find src include -name '*.c') | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*.*.*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
|
Copilot marked this conversation as resolved.
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install cmake | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake | ||
| - name: Build (Release) | ||
| run: | | ||
| cmake -B build -S . -DCMAKE_BUILD_TYPE=Release | ||
| cmake --build build | ||
| - name: Create release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: build/shell | ||
| generate_release_notes: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,58 @@ | ||
| # Trigger | ||
|
|
||
| ## Overview | ||
|
|
||
| This project aims to create a clean, efficient shell. | ||
|
|
||
| ## Building | ||
|
|
||
| ```bash | ||
| cmake -B cmake-build-debug -S . | ||
| cmake --build cmake-build-debug | ||
| ``` | ||
|
|
||
| ## Running | ||
|
|
||
| ```bash | ||
| ./cmake-build-debug/shell | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| The project includes comprehensive unit tests for all modules. To run the tests: | ||
|
|
||
| ```bash | ||
| # Quick way | ||
| ./run_tests.sh | ||
|
|
||
| # Or manually | ||
| cd cmake-build-debug | ||
| ctest --verbose | ||
| ``` | ||
|
|
||
| All tests use a custom lightweight testing framework that provides colored output and clear assertion messages. | ||
|
|
||
| ## Goals | ||
|
|
||
| - Develop a functional, well‑structured shell. | ||
| - Ensure the shell is performant and easy to use. | ||
| - Continuously improve the project as I learn more. | ||
| - Maintain high code quality with unit tests. | ||
|
|
||
| ## Inspiration | ||
|
|
||
| I’ll start by adapting the simple shell tutorial from Brennan Baker: | ||
|
|
||
| <https://brennan.io/2015/01/16/write-a-shell-in-c/> | ||
|
|
||
| This will serve as a solid foundation, which I'll later expand and customize. The resulting shell, named **Trigger**, will combine the tutorial's core ideas with additional features and optimizations. | ||
|
|
||
| ## Development | ||
|
|
||
| Feature development is a collaboration between the project author and AI tooling: the | ||
| author reviews, directs, and integrates AI-generated contributions alongside | ||
| hand-written logic. All changes undergo code review before landing. | ||
|
|
||
| Feel free to explore the repository, submit issues, or contribute improvements. | ||
| # Trigger | ||
|
|
||
| [](https://github.com/melogtm/trigger/actions/workflows/ci.yml) | ||
|
|
||
| ## Overview | ||
|
|
||
| This project aims to create a clean, efficient shell. | ||
|
|
||
| ## Building | ||
|
|
||
| ```bash | ||
| cmake -B cmake-build-debug -S . | ||
| cmake --build cmake-build-debug | ||
| ``` | ||
|
|
||
| ## Running | ||
|
|
||
| ```bash | ||
| ./cmake-build-debug/shell | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| The project includes comprehensive unit tests for all modules. To run the tests: | ||
|
|
||
| ```bash | ||
| # Quick way | ||
| ./run_tests.sh | ||
|
|
||
| # Or manually | ||
| cd cmake-build-debug | ||
| ctest --verbose | ||
| ``` | ||
|
|
||
| All tests use a custom lightweight testing framework that provides colored output and clear assertion messages. | ||
|
|
||
| ## Goals | ||
|
|
||
| - Develop a functional, well‑structured shell. | ||
| - Ensure the shell is performant and easy to use. | ||
| - Continuously improve the project as I learn more. | ||
| - Maintain high code quality with unit tests. | ||
|
|
||
| ## Inspiration | ||
|
|
||
| I’ll start by adapting the simple shell tutorial from Brennan Baker: | ||
|
|
||
| <https://brennan.io/2015/01/16/write-a-shell-in-c/> | ||
|
|
||
| This will serve as a solid foundation, which I'll later expand and customize. The resulting shell, named **Trigger**, will combine the tutorial's core ideas with additional features and optimizations. | ||
|
|
||
| ## Development | ||
|
|
||
| Feature development is a collaboration between the project author and AI tooling: the | ||
| author reviews, directs, and integrates AI-generated contributions alongside | ||
| hand-written logic. All changes undergo code review before landing. | ||
|
|
||
| Feel free to explore the repository, submit issues, or contribute improvements. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,16 @@ | ||
| #ifndef BUILTINS_H | ||
| #define BUILTINS_H | ||
|
|
||
| int trigger_cd(char **args); | ||
| int trigger_help(char **args); | ||
| int trigger_exit(char **args); | ||
| int trigger_pwd(char **args); | ||
| int trigger_echo(char **args); | ||
| int trigger_export(char **args); | ||
| int trigger_unset(char **args); | ||
| int trigger_num_builtins(void); | ||
|
|
||
| extern char *builtin_str[]; | ||
| extern int (*builtin_func[])(char **); | ||
|
|
||
| #endif | ||
| #ifndef BUILTINS_H | ||
| #define BUILTINS_H | ||
| int trigger_cd(char **args); | ||
| int trigger_help(char **args); | ||
| int trigger_exit(char **args); | ||
| int trigger_pwd(char **args); | ||
| int trigger_echo(char **args); | ||
| int trigger_export(char **args); | ||
| int trigger_unset(char **args); | ||
| int trigger_num_builtins(void); | ||
| extern char *builtin_str[]; | ||
| extern int (*builtin_func[])(char **); | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,10 @@ | ||
| #ifndef EXECUTE_H | ||
| #define EXECUTE_H | ||
|
|
||
| #define CHILD_PROCESS_EXITED 0 | ||
| #define EXEC_RETURNED_FAILURE (-1) | ||
|
|
||
| int trigger_launch(char **args); | ||
| int trigger_execute(char ***args_ptr, int **glob_eligible_ptr); | ||
|
|
||
| #endif | ||
|
|
||
| #ifndef EXECUTE_H | ||
| #define EXECUTE_H | ||
|
|
||
| #define CHILD_PROCESS_EXITED 0 | ||
| #define EXEC_RETURNED_FAILURE (-1) | ||
|
|
||
| int trigger_launch(char **args); | ||
| int trigger_execute(char ***args_ptr, int **glob_eligible_ptr); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| #ifndef GLOB_EXPAND_H | ||
| #define GLOB_EXPAND_H | ||
|
|
||
| char **expand_globs(char **argv, int **glob_eligible_ptr); | ||
|
|
||
| #endif | ||
| #ifndef GLOB_EXPAND_H | ||
| #define GLOB_EXPAND_H | ||
| char **expand_globs(char **argv, int **glob_eligible_ptr); | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,12 @@ | ||
| #ifndef INPUT_H | ||
| #define INPUT_H | ||
|
|
||
| #define TRIGGER_AUTOMATIC_BUFFER_SIZE 0 | ||
| #define GET_LINE_REACHED_END_OF_FILE_OR_ERROR (-1) | ||
| #define TRIGGER_TOK_DELIM " \t\r\n\a" | ||
|
|
||
| char *trigger_read_line(void); | ||
| char **trigger_split_line(const char *line); | ||
| char **trigger_split_line_ex(const char *line, int **out_glob_eligible); | ||
|
|
||
| #endif | ||
|
|
||
| #ifndef INPUT_H | ||
| #define INPUT_H | ||
|
|
||
| #define TRIGGER_AUTOMATIC_BUFFER_SIZE 0 | ||
| #define GET_LINE_REACHED_END_OF_FILE_OR_ERROR (-1) | ||
| #define TRIGGER_TOK_DELIM " \t\r\n\a" | ||
|
|
||
| char *trigger_read_line(void); | ||
| char **trigger_split_line(const char *line); | ||
| char **trigger_split_line_ex(const char *line, int **out_glob_eligible); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| #ifndef PIPELINE_H | ||
| #define PIPELINE_H | ||
|
|
||
| typedef struct { | ||
| char **argv; | ||
| char *infile; | ||
| char *outfile; | ||
| int append; | ||
| } PipelineStage; | ||
|
|
||
| PipelineStage *trigger_parse_pipeline(char **tokens, int *num_stages); | ||
| int trigger_execute_pipeline(PipelineStage *stages, int num_stages); | ||
|
|
||
| #endif | ||
| #ifndef PIPELINE_H | ||
| #define PIPELINE_H | ||
| typedef struct { | ||
| char **argv; | ||
| char *infile; | ||
| char *outfile; | ||
| int append; | ||
| } PipelineStage; | ||
| PipelineStage *trigger_parse_pipeline(char **tokens, int *num_stages); | ||
| int trigger_execute_pipeline(PipelineStage *stages, int num_stages); | ||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.