Skip to content

Commit 3ac5c70

Browse files
committed
Run separate jobs for each nightly build
1 parent be45312 commit 3ac5c70

File tree

1 file changed

+36
-29
lines changed

1 file changed

+36
-29
lines changed

.github/workflows/daily-branch-verification.yml

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,40 @@ on:
66
workflow_dispatch: # Allows manual triggering of the workflow
77

88
jobs:
9-
verify-branches:
9+
# Get the list of branches dynamically
10+
get-branches:
1011
runs-on: ubuntu-latest
12+
outputs:
13+
branches: ${{ steps.get-branches.outputs.branches }}
1114
steps:
1215
- name: Checkout repository
1316
uses: actions/checkout@v3
1417
with:
1518
fetch-depth: 0 # Fetch all branches and history
1619

17-
# Step 2: Set up JDK 17 (adjust if you're using a different version)
20+
- name: Get list of branches
21+
id: get-branches
22+
run: |
23+
# List all branches except HEAD and remove origin/ prefix
24+
git fetch --all
25+
branches=$(git branch -r | grep -v '\->' | grep -v HEAD | grep 'origin/sample-code' | sed 's/origin\///')
26+
echo "branches=$branches" >> $GITHUB_ENV
27+
echo "::set-output name=branches::$(echo $branches | tr '\n' ',')"
28+
29+
# Run Maven verify on each branch in parallel
30+
verify-branches:
31+
needs: get-branches
32+
runs-on: ubuntu-latest
33+
strategy:
34+
matrix:
35+
branch: ${{ fromJson(needs.get-branches.outputs.branches) }}
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v3
39+
with:
40+
ref: ${{ matrix.branch }}
41+
fetch-depth: 0 # Fetch the branch
42+
1843
- name: Set up JDK 17
1944
uses: actions/setup-java@v3
2045
with:
@@ -26,7 +51,6 @@ jobs:
2651
with:
2752
node-version: '20'
2853

29-
# Step 3: Install Maven 3.9.9
3054
- name: Setup Maven Action
3155
3256
with:
@@ -38,30 +62,13 @@ jobs:
3862
- name: Install Playwright dependencies
3963
run: npx playwright install-deps
4064

41-
- name: Get list of branches
42-
id: get-branches
43-
run: |
44-
# List all branches except the HEAD and remove origin/ prefix
45-
git fetch --all
46-
git branch -r | grep -v '\->' | grep -v HEAD | grep 'origin/sample-code' | sed 's/origin\///' > branches.txt
47-
48-
- name: Show all branches to verify
49-
run: cat branches.txt
50-
51-
- name: Run Maven Verify on Each Branch
65+
- name: Run Maven Verify
5266
run: |
53-
while read branch; do
54-
echo "Processing branch: $branch"
55-
56-
# Checkout the branch
57-
git checkout $branch
58-
59-
# Run Maven verify
60-
mvn clean verify
61-
62-
if [ $? -ne 0 ]; then
63-
echo "Maven verify failed on branch: $branch"
64-
else
65-
echo "Maven verify succeeded on branch: $branch"
66-
fi
67-
done < branches.txt
67+
echo "Processing branch: ${{ matrix.branch }}"
68+
git checkout ${{ matrix.branch }}
69+
mvn clean verify
70+
if [ $? -ne 0 ]; then
71+
echo "Maven verify failed on branch: ${{ matrix.branch }}"
72+
else
73+
echo "Maven verify succeeded on branch: ${{ matrix.branch }}"
74+
fi

0 commit comments

Comments
 (0)