@@ -2,7 +2,7 @@ name: Integration tests
22
33on :
44 push :
5- branches : ["**"]
5+ branches : [ "**" ]
66
77concurrency :
88 group : integration-test-${{ github.ref }}
1212 split-total : 4
1313
1414jobs :
15+ download-junit-reports-test :
16+ name : Download JUnit reports
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Checkout split-tests-java-action
20+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
21+
22+ - name : Create JUnit reports branch
23+ run : |
24+ BRANCH=junit-reports-it-${{ github.sha }}-download
25+ echo "Creating branch $BRANCH"
26+ git switch --orphan $BRANCH
27+ git config user.name "${{ github.actor }}"
28+ git config user.email "${{ github.actor }}@users.noreply.github.com"
29+ touch first.xml
30+ git add *.xml
31+ git commit -m "Initial commit for JUnit reports branch"
32+ SHA=$(git rev-parse HEAD)
33+ git push origin --set-upstream $BRANCH
34+ git switch ${{ github.ref_name }}
35+ echo "Saving expexted JUnit reports SHA $SHA"
36+ echo "expected-junit-reports-sha=${SHA}" >> "$GITHUB_ENV"
37+
38+ - name : Download JUnit reports
39+ uses : ./download-junit-reports
40+ with :
41+ git-branch : junit-reports-it-${{ github.sha }}-download
42+ path : junit-reports-first
43+
44+ - name : Assert JUnit reports
45+ working-directory : junit-reports-first
46+ run : |
47+ REPORT_FILE="first.xml"
48+ if [[ ! -f "$REPORT_FILE" ]]; then
49+ echo "Error: JUnit report $REPORT_FILE not found!"
50+ ls -l
51+ exit 1
52+ fi
53+ FILE_COUNT=$(ls -1 | wc -l)
54+ if [[ "$FILE_COUNT" -ne 1 ]]; then
55+ echo "Error: Expected 1 JUnit reports, but found $FILE_COUNT files!"
56+ ls -l
57+ exit 1
58+ fi
59+
60+ - name : Update JUnit reports
61+ working-directory : junit-reports-first
62+ run : |
63+ touch second.xml
64+ git add *.xml
65+ git config user.name "${{ github.actor }}"
66+ git config user.email "${{ github.actor }}@users.noreply.github.com"
67+ git commit -m "Second commit for JUnit reports branch"
68+ git push
69+
70+ - name : Download JUnit reports
71+ uses : ./download-junit-reports
72+ with :
73+ git-branch : junit-reports-it-${{ github.sha }}-download
74+ path : junit-reports-second
75+
76+ - name : Assert JUnit reports
77+ working-directory : junit-reports-second
78+ run : |
79+ REPORT_FILE="first.xml"
80+ if [[ ! -f "$REPORT_FILE" ]]; then
81+ echo "Error: JUnit report $REPORT_FILE not found!"
82+ ls -l
83+ exit 1
84+ fi
85+ FILE_COUNT=$(ls -1 | wc -l)
86+ if [[ "$FILE_COUNT" -ne 1 ]]; then
87+ echo "Error: Expected 1 JUnit reports, but found $FILE_COUNT files!"
88+ ls -l
89+ exit 1
90+ fi
91+
92+ - name : Download JUnit reports SHA artifact
93+ uses : actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4
94+ with :
95+ name : junit-xml-reports-sha
96+ path : junit-xml-reports-sha-artifact-assertion
97+
98+ - name : Assert JUnit reports SHA artifact
99+ working-directory : junit-xml-reports-sha-artifact-assertion
100+ run : |
101+ SHA_FILE="junit-reports-sha.txt"
102+ if [[ ! -f "$SHA_FILE" ]]; then
103+ echo "Error: JUnit reports SHA file $SHA_FILE not found!"
104+ ls -l
105+ exit 1
106+ fi
107+ FILE_COUNT=$(ls -1 | wc -l)
108+ if [[ "$FILE_COUNT" -ne 1 ]]; then
109+ echo "Error: Expected 1 JUnit reports SHA file, but found $FILE_COUNT files!"
110+ ls -l
111+ exit 1
112+ fi
113+ ARTIFACT_SHA=$(cat $SHA_FILE)
114+ if [ "$ARTIFACT_SHA" != "${{ env.expected-junit-reports-sha }}" ]; then
115+ echo "Error: JUnit reports SHA $ARTIFACT_SHA in artifact does not match expected SHA ${{ env.expected-junit-reports-sha }}"
116+ exit 1
117+ fi
118+
119+ - name : Clean up JUnit reports branch
120+ if : always()
121+ run : |
122+ git push origin --delete junit-reports-it-${{ github.sha }}-download || true
123+
124+ - name : Clean up JUnit reports artifact
125+ uses : geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5
126+ with :
127+ name : junit-xml-reports-sha
128+ failOnError : false
129+
15130 generate-split-index-json :
16131 name : Generate split indexes
17132 runs-on : ubuntu-latest
133+ needs :
134+ download-junit-reports-test
18135 outputs :
19136 json : ${{ steps.generate.outputs.split-index-json }}
20137 steps :
@@ -192,7 +309,7 @@ jobs:
192309 exit 1
193310 fi
194311
195- - name : Cleanup JUnit reports branch
312+ - name : Clean up JUnit reports branch
196313 if : always()
197314 run : |
198315 git push origin --delete junit-reports-it-${{ github.sha }}-existing || true
@@ -277,7 +394,7 @@ jobs:
277394 exit 1
278395 fi
279396
280- - name : Cleanup JUnit reports branch
397+ - name : Clean up JUnit reports branch
281398 if : always()
282399 run : |
283400 git push origin --delete junit-reports-it-${{ github.sha }}-new || true
0 commit comments