Skip to content

Commit ed7c2b6

Browse files
authored
Update Action to group SNAPSHOT tests (#1439)
* Update Action to group SNAPSHOT tests * Add manual trigger
1 parent 5beb3c2 commit ed7c2b6

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

.github/workflows/snapshot.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,66 @@
1-
name: Test SNAPSHOT
1+
name: Test SNAPSHOT Guides
22
on:
33
schedule:
44
- cron: '0 5 * * 1-5'
5+
workflow_dispatch:
56
jobs:
7+
test_matrix:
8+
name: Generate Guide Test Matrix
9+
runs-on: ubuntu-latest
10+
outputs:
11+
matrix: ${{ steps.test_matrix_step.outputs.matrix }}
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up JDK
15+
uses: actions/setup-java@v4
16+
with:
17+
distribution: 'adopt'
18+
java-version: '17'
19+
- uses: actions/cache@v3
20+
with:
21+
path: ~/.gradle/caches
22+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
23+
restore-keys: |
24+
${{ runner.os }}-gradle-
25+
- name: Generate Guide Test Matrix
26+
id: test_matrix_step
27+
run: |
28+
echo "Searching for groups..."
29+
gradleTasks=$(./gradlew tasks | grep "Run group of guide tests" | sed 's/\(.*\) - Run group of guide tests/\"\1\"/' | tr '\n' ',' | sed 's/.$//')
30+
tasksEntry="\"group_test_tasks\":[$(echo $gradleTasks)]"
31+
matrixValue="{$(echo $tasksEntry)}"
32+
echo "Created matrix: $matrixValue"
33+
echo "matrix=$matrixValue" >> $GITHUB_OUTPUT
634
alltests:
35+
name: Running SNAPSHOT ${{ matrix.group }} with Java ${{ matrix.java }}
36+
needs: test_matrix
737
runs-on: ubuntu-latest
838
strategy:
939
matrix:
1040
java: ["17", "21"]
41+
group: ${{ fromJson(needs.test_matrix.outputs.matrix).group_test_tasks }}
1142
env:
1243
JDK_VERSION: ${{ matrix.java }}
1344
steps:
14-
- uses: actions/checkout@v2
45+
- uses: actions/checkout@v4
1546
with:
1647
fetch-depth: 0
17-
- uses: actions/cache@v2
48+
- uses: actions/cache@v3
1849
with:
1950
path: ~/.gradle/caches
2051
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
2152
restore-keys: |
2253
${{ runner.os }}-gradle-
2354
- name: Set up JDK
24-
uses: actions/setup-java@v1
55+
uses: actions/setup-java@v4
2556
with:
57+
distribution: 'adopt'
2658
java-version: ${{ matrix.java }}
2759
- name: Use next snapshot patch version
2860
run: ./increment_version.sh -p
2961
- name: Run All Guide Tests
30-
run: './gradlew runAllGuideTests'
62+
run: './gradlew ${{ matrix.group }}'
3163
env:
32-
AWS_ACCESS_KEY_ID: XXX
33-
AWS_SECRET_ACCESS_KEY: YYY
34-
AWS_REGION: us-east-1
3564
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
3665
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
3766
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}

0 commit comments

Comments
 (0)