-
Notifications
You must be signed in to change notification settings - Fork 16
feat: Add workflow to run and validate unit tests #1835
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
7 commits
Select commit
Hold shift + click to select a range
1a94a6e
feat: Add workflow to run and validate unit tests
aman19K 89a1c38
added script to run unit testcases in audit plugin
aman19K 3ca9c8f
fix: script
aman19K 7307e84
refactor: remove export-to-csv from workflow
aman19K 5fdf6b4
refactor: run unit tests only for affected plugins
aman19K b547792
fix
aman19K 297a277
test audit trigger
aman19K 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,53 @@ | ||
| name: Run Unit Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| jobs: | ||
| run-tests: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.x' | ||
|
|
||
| - name: Install dependencies for all plugins | ||
| run: | | ||
| npm run setup-repo-old | ||
|
|
||
| - name: Fetch latest references | ||
| run: | | ||
| git fetch --prune | ||
|
|
||
| - name: Identify Changed Plugins | ||
| id: changes | ||
| run: | | ||
| echo "Finding changed files..." | ||
| # Ensure both commit references are valid | ||
| if [[ -z "${{ github.event.before }}" || -z "${{ github.sha }}" ]]; then | ||
| echo "Error: Missing commit references" | ||
| exit 1 | ||
| fi | ||
|
|
||
| CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) | ||
| echo "Changed files:" | ||
| echo "$CHANGED_FILES" | ||
|
|
||
| # Identify affected plugins | ||
| AFFECTED_PLUGINS=$(echo "$CHANGED_FILES" | grep -oP '(?<=^packages/)([^/]+)' | sort -u | tr '\n' ' ') | ||
| echo "Affected plugins: $AFFECTED_PLUGINS" | ||
|
|
||
| # Set output for the next step | ||
| echo "::set-output name=affected_plugins::$AFFECTED_PLUGINS" | ||
|
|
||
| - name: Run Unit Tests for Affected Plugins | ||
| run: | | ||
| for plugin in ${{ steps.changes.outputs.affected_plugins }}; do | ||
| echo "Running tests for $plugin..." | ||
| npm run test:unit --prefix ./packages/$plugin | ||
| done | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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.