Skip to content

Daily Maven Verify on All Branches #12

Daily Maven Verify on All Branches

Daily Maven Verify on All Branches #12

name: Daily Maven Verify on All Branches
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
verify-branches:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all branches and history
# Step 2: Set up JDK 17 (adjust if you're using a different version)
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
# Step 3: Install Maven 3.9.9
- name: Setup Maven Action
uses: s4u/setup-maven-action@v1.7.0
with:
checkout-fetch-depth: 0
java-version: 17
java-distribution: temurin
maven-version: 3.9.9
- name: Install Playwright dependencies
run: npx playwright install-deps
- name: Get list of branches
id: get-branches
run: |
# List all branches except the HEAD and remove origin/ prefix
git fetch --all
git branch -r | grep -v '\->' | grep -v HEAD | grep 'origin/sample-code' | sed 's/origin\///' > branches.txt
- name: Show all branches to verify
run: cat branches.txt
- name: Run Maven Verify on Each Branch
run: |
while read branch; do
echo "Processing branch: $branch"
# Checkout the branch
git checkout $branch
# Run Maven verify
mvn clean verify
if [ $? -ne 0 ]; then
echo "Maven verify failed on branch: $branch"
else
echo "Maven verify succeeded on branch: $branch"
fi
done < branches.txt