Commit Graph

36 Commits

Author SHA1 Message Date
Ian Wijma 5c19c27136 Add readme.md file
A new readme.md file is added to provide detailed information about usage of Keep Running application. The readme describes the purpose of the application, how to use it, its default settings, arguments and options. It also provides a use case example for better understanding.
2023-11-23 21:27:15 +11:00
Ian Wijma aad5010257 Update workflow run-name and remove id from 'Compile and release'
The run-name in the Github actions workflow 'release.yaml' was updated for clarity, now indicating that the files are being built for release. An unnecessary id tag was removed from the 'Compile and release' step, simplifying the workflow. This makes the functioning of the workflow easier to understand and manage.
2023-11-21 01:13:08 +11:00
Ian Wijma ffa6d18e5e Update GitHub CI action trigger in release.yaml
Changed the event trigger of the GitHub Actions workflow "release.yaml" from a generic 'release' event to specifically when a 'release' is 'created'. This provides the detailed triggering condition for the workflow, ensuring it only runs when needed, improving workflow optimization.
2023-11-21 01:10:07 +11:00
Ian Wijma 049a75e300 Update version and fix CI action name
Updated kr package's version to 1.0.2 in Cargo.toml and Cargo.lock files. Also, fixed the wrong property reference in the GitHub Actions release workflow. From "gitea.actor" to "github.actor" which might have caused incorrect workflow run name in GitHub CI/CD.
2023-11-21 01:07:37 +11:00
Ian Wijma dcf83a351f Update version and fix CI action name
Updated kr package's version to 1.0.2 in Cargo.toml and Cargo.lock files. Also, fixed the wrong property reference in the GitHub Actions release workflow. From "gitea.actor" to "github.actor" which might have caused incorrect workflow run name in GitHub CI/CD.
2023-11-21 01:03:51 +11:00
Ian Wijma 66ab232c9d Updated .gitignore, Cargo.toml and release.yaml files
This commit adds newline at the end of the .gitignore and release.yaml files to adhere to posix standard while removing unnecessary whitespace in Cargo.toml file. Changes are made for better code health and adhering to standards.
2023-11-21 00:57:18 +11:00
Ian Wijma 99947dbefd Refactor spawn_process fn to handle spawn error
This commit modifies the spawn_process function to explicitly return a Result type, handling the error of the spawn() method. This change improves the readability of the error handling and makes it more idiomatic in Rust. As a secondary correction, it fixes a typo in a print statement.
2023-11-21 00:34:53 +11:00
Ian Wijma df5776e76d Refactor spawn_process fn to handle spawn error
This commit modifies the spawn_process function to explicitly return a Result type, handling the error of the spawn() method. This change improves the readability of the error handling and makes it more idiomatic in Rust. As a secondary correction, it fixes a typo in a print statement.
2023-11-21 00:31:40 +11:00
Ian Wijma 563938e51a Refactor spawn_process fn to handle spawn error
This commit modifies the spawn_process function to explicitly return a Result type, handling the error of the spawn() method. This change improves the readability of the error handling and makes it more idiomatic in Rust. As a secondary correction, it fixes a typo in a print statement.
2023-11-21 00:31:37 +11:00
Ian Wijma 8e6950270e Simplify workflow trigger for releases
Refactored the workflow trigger for releases in 'release.yaml' to directly listen to release events. The change simplifies the code and aligns with the syntax used in other parts of the workflow. It was necessary for maintaining consistency and cleanliness of the workflows codebase.
2023-11-21 00:21:06 +11:00
Ian Wijma d2f72f4ad7 Upgrade kr package to version 1.0.0.
In this commit, we've updated the kr package from version 0.1.0 to 1.0.0 in the Cargo.toml file, signifying a milestone update recognizing the project's stability and maturity.
2023-11-21 00:13:22 +11:00
Ian Wijma 45925b56f1 Merge remote-tracking branch 'origin/main' 2023-11-21 00:12:43 +11:00
Ian Wijma 20bfc647af Update kr package version in Cargo.toml
The kr package version was updated from 0.1.0 to 1.0.0 in the Cargo.toml file. This change indicates that the project has reached a significant milestone and is now considered mature and stable enough for a major version release.
2023-11-21 00:12:35 +11:00
Ian Wijma 250bc93b2d Update kr package version in Cargo.toml
The kr package version was updated from 0.1.0 to 1.0.0 in the Cargo.toml file. This change indicates that the project has reached a significant milestone and is now considered mature and stable enough for a major version release.
2023-11-21 00:11:56 +11:00
Ian Wijma 1a1d539e27 Merge pull request 'topic/rust' (#2) from topic/rust into main
Reviewed-on: #2
2023-11-20 13:10:23 +00:00
Ian Wijma b7583f4db0 Update Cargo.toml for optimized release binary
Configured the `Cargo.toml` to automatically strip symbols, optimize for size, enable Link Time Optimization (LTO), and set codegen-units to 1 for the release profile. This significantly reduces the size and improves the performance of the resulting binary.
2023-11-21 00:08:17 +11:00
Ian Wijma 9392325115 Correct commit message for the given diff:
Add newline character to error message

In this commit, a newline character `\n` was added at the end of the error message in the `print!` function within main.rs. This change ensures the output from the program is properly formatted and readable, increasing the overall user experience when such exceptions are encountered.
2023-11-21 00:08:03 +11:00
Ian Wijma a5dd011506 Renamed workflow and adjusted it to handle releases
In this commit, I've renamed the name of the workflow from build.yaml to release.yaml. It now gets triggered on 'release' instead of 'push'. The job names and some parameters were also altered to fit into the new release context. The aim of this modification is to optimize the project delivery process as the workflow is now focus on handling final product releases.
2023-11-21 00:00:05 +11:00
Ian Wijma 0b686e86d9 Update build.yaml to streamline compilation and packaging process
Keep Running / Build (tar.gz tar.xz tar.zst, x86_64-unknown-linux-musl) (push) Successful in 1m54s Details
Keep Running / Build (zip, x86_64-apple-darwin) (push) Successful in 1m9s Details
Keep Running / Build (zip, x86_64-pc-windows-gnu) (push) Successful in 1m9s Details
This commit simplifies and optimizes the build workflow process by leveraging the rust-build action for compiling and releasing. The "build.yaml" file has been revised to include different targets and types of archives as per the platform. Also, previous separate jobs for checking out, installing dependencies, building project, and creating/uploading archives have been removed. The new strategy is aimed to reduce redundancy, speed up the process, and allow seamless multi-platform build support.
2023-11-20 23:47:04 +11:00
Ian Wijma b0daf0db5f Improve script safety by quoting variables and updating comparisons
This commit updates the `test.sh` script to incorporate best shell scripting practices. Changes include quoting the variables "$SLEEP" and "$EXIT" to handle null or space-containing values better. The arithmetic comparison has been updated to use "bash-style" to improve the script's security. This refactoring aims to enhance the overall efficiency and reliability of the script execution.
2023-11-20 23:40:56 +11:00
Ian Wijma 8581f19127 Remove outdated codebase
This commit deletes the current codebase and configurations because we're switching to rust. This includes src/index.js, package.json, package-lock.json and .gitignore files. A refactor or rewrite app with updated dependencies and code style will be added afterwards.
2023-11-20 23:40:22 +11:00
Ian Wijma 99cc6708c6 Add new scripts to package.json and handle rpm/rph conflict
Keep Running / Build (push) Failing after 2m51s Details
Updated the package.json with two new scripts: copy-local and build-local. This allows for easier local testing by building and copying the program to a local directory. In index.js, handled the situation where both rpm and rph options are provided by the user, which was causing conflicts. This is resolved by adding explicit handling which returns an error and asks the user to choose only one.
2023-11-19 16:19:24 +11:00
Ian Wijma 8e80da343b Add OS-specific build archives to GitHub workflow
Keep Running / Build (push) Failing after 2m45s Details
Updated GitHub Actions workflow to create and upload build archives for Linux, MacOS and Windows. Previously, we were creating a single archive without specifying the intended operating system which might lead to compatibility issues. This update will create separate build archives for each OS, making it easier for users to download the correct version for their system.
2023-11-19 16:05:18 +11:00
Ian Wijma acd0ab94ef Correct typo in the build configuration of GitHub workflow
Keep Running / Build (push) Failing after 2m57s Details
Corrected a typo in the build configuration of the GitHub workflow from 'desc' to 'dest' in line 19. This was misnaming the destination file for the zipping process, impeding the correct the creation of 'build.zip' from the files in the 'out' directory. This fix will ensure that the workflow runs as expected and produces a 'build.zip' for the archive upload.
2023-11-19 15:54:45 +11:00
Ian Wijma abf9d267fe Streamline steps and add build zip in GitHub Workflow
Keep Running / Build (push) Successful in 36s Details
Streamlined the steps in the GitHub Actions workflow and added a zipping process using 'action-zip' to create 'build.zip'. This change optimizes the workflow runtime and ensures a more efficient archiving and retrieval of the built files in the 'out' directory, improving the workflow's overall performance.
2023-11-19 15:53:23 +11:00
Ian Wijma e50fb62be8 Streamline steps and add build zip in GitHub Workflow
Keep Running / Build (push) Successful in 37s Details
Streamlined the steps in the GitHub Actions workflow and added a zipping process using 'action-zip' to create 'build.zip'. This change optimizes the workflow runtime and ensures a more efficient archiving and retrieval of the built files in the 'out' directory, improving the workflow's overall performance.
2023-11-19 15:51:43 +11:00
Ian Wijma 4a13dd9fb2 Update artifact path in GitHub Workflow
Keep Running / Build (push) Successful in 49s Details
The artifact path in the GitHub Actions workflow has been updated from 'bin' to 'out'. This alteration occurs in order to match the new directory structure after the build process, ensuring that the correct files are being archived after each workflow run.
2023-11-19 15:43:47 +11:00
Ian Wijma 6b2362c541 Your commit message does not match the diff provided. Based on the diff, a suitable commit message would be:
Keep Running / Build (push) Successful in 35s Details
"Change GitHub Actions trigger event"

The trigger event for the GitHub Actions workflow was changed from 'release' to 'push'. This modification ensures that the workflow runs every time a push is made to the repository. This change was necessary to continuously check code integrity on all commits, making sure that every code pushed to the repository has been tested and approved by the set-up workflow.
2023-11-19 15:41:22 +11:00
Ian Wijma a65ca4e37f "Added .help() method in the command configuration"
In this commit, the .help() method was moved to an earlier part of the command configuration. Previously, .help() was executed after defining options. The reason for this change was to improve code readability and ensure that the help command is processed in line with other commands, improving user experience by offering immediate assistance for all commands. This effective placement of .help() method should make it easier for users to understand how to interact with the command line interface.
2023-11-19 15:40:19 +11:00
Ian Wijma 7a43503c52 "Added delay option and improved error logging in process manager"
This commit introduces a delay option to the process manager. This option allows us to set the time delay before restarting a process that has crashed. This is useful in scenarios where an immediate restart might cause further issues or allow time for external dependencies to become available again.

It also refines the error logging by reducing the amount of crash logs printed. Now, only the last crash log is presented which aides in maintaining readability. A conflict prevention has been also added to reduce the chance of mixed usage between 'rpm' and 'rph' options.

The update also enforces tidiness by adding an extraneous file to the .gitignore list.
2023-11-19 15:38:49 +11:00
Ian Wijma 84f6c26361 Fix the retrying not working. 2023-11-19 14:21:54 +11:00
Ian Wijma 5c7b1081ad run.sh > test.sh to clearify the command is for testing purposes. 2023-11-19 13:37:03 +11:00
Ian Wijma 77e1f29417 Added stderr output to the test command & updated console output 2023-11-19 13:36:20 +11:00
Ian Wijma afccf3a5c5 Updated the run command to have a custom exit code 2023-11-19 13:31:53 +11:00
Ian Wijma e53eb5fd4d Added pkg 2023-11-19 13:30:11 +11:00
Ian Wijma 510d299276 Created Keep Running (kr) command 2023-11-19 13:28:59 +11:00