Skip to content

Implement a new KeyStore file to configure the persistence logic #56

Implement a new KeyStore file to configure the persistence logic

Implement a new KeyStore file to configure the persistence logic #56

Workflow file for this run

name: Continuous Integration
on:
pull_request:
paths:
- "plugins/**/*.java" # Match changes in Java files.
- "plugins/**/*.gradle" # Match changes in Gradle configuration.
jobs:
ci:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
# Step to fetch the base branch for comparison
- name: Fetch base branch
run: |
# Fetch the base branch (e.g., main or develop) to compare against
git fetch origin ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }}
# Step to find which project folder contains modified files
- name: Detect modified plugins
id: detect_changes
run: |
# Compare the changes between the current branch and the base branch
CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }})
echo $CHANGED_FILES
# Check if any files are modified in wazuh-indexer-setup
if echo "$CHANGED_FILES" | grep -q "^plugins/setup/"; then
echo "setup" >> affected_projects.txt
fi
# Check if any files are modified in wazuh-command-manager
if echo "$CHANGED_FILES" | grep -q "^plugins/command-manager/"; then
echo "command-manager" >> affected_projects.txt
fi
# Output the list of affected projects
if [ -f affected_projects.txt ]; then
echo "projects=$(cat affected_projects.txt | paste -sd,)" >> $GITHUB_OUTPUT
else
echo "projects=none" >> $GITHUB_OUTPUT
fi
# Run tests for affected projects
- name: Run tests for affected projects
run: |
if [[ "${{ steps.detect_changes.outputs.projects }}" != "none" ]]; then
for project in $(echo "${{ steps.detect_changes.outputs.projects }}" | tr ',' ' '); do
echo "Running tests for $project"
cd plugins/$project
./gradlew check
cd - # Go back to the root folder
done
else
echo "No changes in Java or Gradle files to test."
fi