-
Notifications
You must be signed in to change notification settings - Fork 7
chore: update CI/CD pipeline, add PR template, and improve documentation #50
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Pull Request | ||
|
|
||
| ## Description | ||
| <!-- A brief description of the changes and the problem they solve. --> | ||
|
|
||
| ## Related Issues | ||
| <!-- List any related issues or tickets (e.g., "Fixes #123"). --> | ||
|
|
||
| ## Type of Change | ||
| - [ ] Bug fix (non-breaking change that fixes an issue) | ||
| - [ ] New feature (non-breaking change that adds functionality) | ||
| - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
| - [ ] Documentation update | ||
|
|
||
| ## Testing | ||
| - [ ] I have added/updated tests for the changes. | ||
| - [ ] All tests pass locally with my changes. | ||
| - [ ] I have tested the changes in the following environments: | ||
| - [ ] Local development | ||
| - [ ] Staging | ||
| - [ ] Production (if applicable) | ||
|
|
||
| ## Documentation | ||
| - [ ] I have updated the documentation to reflect the changes. | ||
| - [ ] The changes are documented in the README or relevant documentation files. | ||
|
|
||
| ## Additional Notes | ||
| <!-- Any additional notes or context for the reviewers. --> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,44 @@ | ||
| name: | ||
| on: [push, pull_request, create, delete, issue_comment] | ||
| name: CI/CD Pipeline | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master ] | ||
| pull_request: | ||
| branches: [ main, master ] | ||
| schedule: | ||
| - cron: '0 0 * * 0' # Weekly run on Sunday at midnight | ||
|
|
||
| jobs: | ||
| build: | ||
| test: | ||
| name: Test on Node.js ${{ matrix.node-version }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| node-version: [12.x, 14.x, 16.x] # Test on multiple Node.js versions | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Use Node.js | ||
| uses: actions/setup-node@v1 | ||
|
|
||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v2 | ||
| with: | ||
| node-version: '12.x' | ||
| - uses: codespell-project/actions-codespell@master | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: 'npm' | ||
|
|
||
| - name: Check for common typos | ||
| uses: khulnasoft/codetypo-actions@master | ||
| with: | ||
| check_filenames: true | ||
| skip: ./.github/*,.git,./package.json,./package-lock.json,./node_modules,./tests,./config,*.png,Dockerfile,./scripts,*.spec.js,./plugins/azure/storageaccounts/storageAccountsAADEnabled.js,./plugins/aws/cloudtrail/cloudtrailBucketAccessLogging.js,./helpers/google/index.js,*zip | ||
| ignore_words_list: iam,\"tRe\",AKS,aks,optin,callInt,callInt | ||
| - run: npm install | ||
|
|
||
|
|
||
| - name: Install Dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Lint | ||
| run: npm run lint | ||
|
|
||
| - name: NPM Test | ||
| - name: Run Tests | ||
| run: npm test | ||
|
|
||
| - name: Build | ||
| run: npm run build --if-present | ||
|
Comment on lines
+43
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (performance): Consider moving the build step to a separate job to avoid redundant builds on every matrix entry. Because Suggested implementation: To complete the change, you should also:
For example (you will need to adjust jobs:
# existing test/matrix job
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
# ... checkout, setup-node, npm ci, lint, test (no build here)
build:
needs: tests # make sure this matches the actual test job id
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js LTS
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build --if-presentEnsure that:
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -77,11 +77,65 @@ A commercial version of CloudExploit hosted at Khulnasoft Wave. Try [Khulnasoft | |||||
| ## Installation | ||||||
| Ensure that NodeJS is installed. If not, install it from [here](https://nodejs.org/download/). | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (typo): Consider using the canonical spelling "Node.js" instead of "NodeJS". To match the official project name and common usage, please change "NodeJS" to "Node.js" here (e.g., "Ensure that Node.js is installed.").
Suggested change
|
||||||
|
|
||||||
| ``` | ||||||
| ```bash | ||||||
| $ git clone git@github.com:cloudexploit/scans.git | ||||||
| $ npm install | ||||||
| ``` | ||||||
|
|
||||||
| ## Development and Testing | ||||||
|
|
||||||
| ### Running Tests | ||||||
|
|
||||||
| To run the test suite, use the following command: | ||||||
|
|
||||||
| ```bash | ||||||
| npm test | ||||||
| ``` | ||||||
|
|
||||||
| ### Running Specific Tests | ||||||
|
|
||||||
| To run a specific test file or test suite, you can use the following command: | ||||||
|
|
||||||
| ```bash | ||||||
| npm test -- <path-to-test-file> | ||||||
| ``` | ||||||
|
|
||||||
| ### Test Coverage | ||||||
|
|
||||||
| To generate a test coverage report, run: | ||||||
|
|
||||||
| ```bash | ||||||
| npm run test:coverage | ||||||
| ``` | ||||||
|
|
||||||
| ### Linting | ||||||
|
|
||||||
| To check for code style issues, run: | ||||||
|
|
||||||
| ```bash | ||||||
| npm run lint | ||||||
| ``` | ||||||
|
|
||||||
| ### CI/CD | ||||||
|
|
||||||
| The project uses GitHub Actions for continuous integration. The following workflows are defined: | ||||||
|
|
||||||
| - **CI Pipeline**: Runs on every push and pull request to the `main` or `master` branch. It includes: | ||||||
| - Linting | ||||||
| - Unit tests across multiple Node.js versions (12.x, 14.x, 16.x) | ||||||
| - Build verification | ||||||
|
|
||||||
| ### Pull Requests | ||||||
|
|
||||||
| When submitting a pull request, please ensure that: | ||||||
|
|
||||||
| 1. All tests pass | ||||||
| 2. The code is properly linted | ||||||
| 3. New features include appropriate tests | ||||||
| 4. Documentation is updated if necessary | ||||||
|
|
||||||
| Use the provided pull request template to ensure consistency in code reviews. | ||||||
|
|
||||||
| ## Configuration | ||||||
| CloudExploit requires read-only permission to your cloud account. Follow the guides below to provision this access: | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 suggestion (security): Update the Node.js matrix to supported LTS versions to avoid running CI on EOL runtimes.
12.x and 14.x are end-of-life and no longer receive security updates. Unless you specifically need to support them, consider updating the matrix to current LTS versions (e.g., 18.x and 20.x) so CI aligns with supported production runtimes and future dependency support.