@@ -10,71 +10,19 @@ jobs:
1010 yarn :
1111 env :
1212 FILE_COUNTER : 0
13- CC_TEST_REPORTER_ID : 9ada3133fe9babf91a222009998b3545b7eae897a05900930bfa8a27fd82f385
1413 ACTION_DEBUG : true
1514
16- name : Create, format and upload Javascript coverage artifact
15+ name : Build and Test React Apps
1716 runs-on : ubuntu-latest
1817 steps :
19- - uses : actions/checkout@v2
20-
21- # Get Code Climate binary
22- - name : Download Code Climate Binary
23- run : curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
24-
25- # Permissions applied to the Code Climate Executable
26- - name : Apply executable perms to Code Climate Binary
27- run : chmod +x ./cc-test-reporter
28-
29- # Before build
30- - name : Before build
31- run : ./cc-test-reporter before-build
32-
33- # Set required Git env vars for either pull request
34- - name : Set ENV for codeclimate (pull_request)
35- run : |
36- echo "GIT_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
37- echo "GIT_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
38- #echo "::set-env name=GIT_BRANCH::${{ github.event.pull_request.head.ref }}"
39- #echo "::set-env name=GIT_COMMIT_SHA::${{ github.event.pull_request.head.sha }}"
40- if : github.event_name == 'pull_request'
41-
42- # Set required Git env vars for a push to master
43- - name : Set ENV for codeclimate (push)
44- run : |
45- echo "GIT_BRANCH=$GITHUB_REF" >> GITHUB_ENV
46- echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> GITHUB_ENV
47- #echo "::set-env name=GIT_BRANCH::$GITHUB_REF"
48- #echo "::set-env name=GIT_COMMIT_SHA::$GITHUB_SHA"
49- if : github.event_name == 'push'
50-
51- # Trimming the ref to master in order to publish correct report (paambaati)
52- - name : Set ref/head/master to master
53- run : |
54- echo "GIT_BRANCH=master" >> $GITHUB_ENV
55- #echo "::set-env name=GIT_BRANCH::master"
56- if : env.GIT_BRANCH == 'refs/heads/master'
18+ - uses : actions/checkout@v4
5719
5820 - name : Printing node and yarn versions
5921 run : node --version && yarn --version
6022 # Figure out where yarn is caching things
6123 - name : Yarn Cache
6224 run : yarn cache dir
6325
64- # Implement Caching Action for Yarn Project
65- - name : Cache node modules
66- uses : actions/cache@v4
67- env :
68- cache-name : cache-node-modules
69- with :
70- # YARN cache files are stored in `/home/runner/.cache/yarn/v6` on git actions
71- path : /home/runner/.cache/yarn/v6
72- key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
73- restore-keys : |
74- ${{ runner.os }}-build-${{ env.cache-name }}-
75- ${{ runner.os }}-build-
76- ${{ runner.os }}-
77-
7826 # Run Yarn Install - eFiling Frontend
7927 - name : Run Yarn Install - eFiling Frontend
8028 run : yarn --cwd src/frontend/efiling-frontend install
@@ -110,49 +58,33 @@ jobs:
11058 # cd ${{github.workspace}}/src/frontend/efiling-demo/
11159 # ${{github.workspace}}/cc-test-reporter format-coverage -t lcov -o ${{github.workspace}}/coverage/frontend-demo-codeclimate.json coverage/lcov.info
11260 # popd
61+ # Implement Caching Action for Yarn Project
62+ - name : Cache node modules
63+ uses : actions/cache@v4
64+ env :
65+ cache-name : cache-node-modules
66+ with :
67+ # YARN cache files are stored in `/home/runner/.cache/yarn/v6` on git actions
68+ path : /home/runner/.cache/yarn/v6
69+ key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
70+ restore-keys : |
71+ ${{ runner.os }}-build-${{ env.cache-name }}-
72+ ${{ runner.os }}-build-
73+ ${{ runner.os }}-
11374
114- # Formatting the FRONTEND coverage report
115- - name : Format the FRONTEND coverage report
116- run : |
117- pushd .
118- cd ${{github.workspace}}/src/frontend/efiling-frontend/
119- ${{github.workspace}}/cc-test-reporter format-coverage -t lcov -o ${{github.workspace}}/coverage/frontend-codeclimate.json coverage/lcov.info
120- popd
121-
122- # List all formatted files in coverage directory
123- - name : WHERE AM I - FORMATTED?
124- run : |
125- ls ${{ github.workspace }}/coverage
126- if : ${{ env.ACTION_DEBUG }}
127-
128- # Count of all total coverage files available
129- - name : Count files present
130- run : |
131- echo "FILE_COUNTER=$(ls -1q ./coverage | wc -l )" >> $GITHUB_ENV
132- #echo "::set-env name=FILE_COUNTER::$(ls -1q ./coverage | wc -l )"
13375
134- # Sum the coverage reports
135- - name : Summing the coverage reports generated
136- run : ./cc-test-reporter sum-coverage coverage/*-codeclimate.json -p ${{ env.FILE_COUNTER }} -o coverage/total-codeclimate.json
13776
138- # Upload JSON for debugging purposes
139- - name : Upload JSON for debugging purposes
140- uses : actions/upload-artifact@v4
141- with :
142- name : summed-yarn-coverage-report
143- path : coverage/total-codeclimate.json
14477
14578 spring-boot :
146- name : Create, format and upload Java coverage artifact
79+ name : Build and Test Java
14780 runs-on : ubuntu-latest
14881 env :
14982 FILE_COUNTER : 0
150- CC_TEST_REPORTER_ID : 9ada3133fe9babf91a222009998b3545b7eae897a05900930bfa8a27fd82f385
15183 ACTION_DEBUG : true
15284
15385 steps :
15486 - name : Checkout Spring Starters Repository
155- uses : actions/checkout@v2
87+ uses : actions/checkout@v4
15688 with :
15789 repository : bcgov/spring-boot-starters
15890 path : spring-boot-starters
@@ -171,35 +103,6 @@ jobs:
171103 - name : Checkout File Submission Repository
172104 uses : actions/checkout@v2
173105
174- # Get Code Climate binary
175- - name : Download Code Climate Binary
176- run : curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
177-
178- # Permissions applied to the Code Climate Executable
179- - name : Apply executable perms to Code Climate Binary
180- run : chmod +x ./cc-test-reporter
181-
182- # Before build
183- - name : Before build
184- run : ./cc-test-reporter before-build
185-
186- # Set required Git env vars for either pull request
187- - name : Set ENV for codeclimate (pull_request)
188- run : |
189- echo "GIT_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
190- echo "GIT_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
191- #echo "::set-env name=GIT_BRANCH::${{ github.event.pull_request.head.ref }}"
192- #echo "::set-env name=GIT_COMMIT_SHA::${{ github.event.pull_request.head.sha }}"
193- if : github.event_name == 'pull_request'
194-
195- # Set required Git env vars for a push to master
196- - name : Set ENV for codeclimate (push)
197- run : |
198- echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV
199- echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
200- #echo "::set-env name=GIT_BRANCH::$GITHUB_REF"
201- #echo "::set-env name=GIT_COMMIT_SHA::$GITHUB_SHA"
202- if : github.event_name == 'push'
203106
204107 # Trimming the ref to master in order to publish correct report (paambaati)
205108 - name : Set ref/head/master to master
@@ -224,146 +127,3 @@ jobs:
224127 # Run Maven Verify to generate all jacoco reports
225128 - name : Build with Maven
226129 run : mvn -B verify -P all --file src/backend/pom.xml
227-
228- # Formatting the BACKEND coverage reports generated (dynamically)
229- - name : Format BACKEND coverage reports
230- run : |
231- projectRelRegex="^\.\/src\/backend\/(.*)\/target\/site\/jacoco\/jacoco\.xml$"
232- for file in $(find . -name "jacoco.xml")
233- do
234- echo $file
235- echo $projectRelRegex
236- if [[ $file =~ $projectRelRegex ]]
237- then
238- projectRel="${BASH_REMATCH[1]}"
239- echo "analyzing project: " $projectRel
240- projectName="${projectRel//\//-}"
241- JACOCO_SOURCE_PATH=${{ github.workspace }}/src/backend/$projectRel/src/main/java ./cc-test-reporter format-coverage ${{github.workspace}}/src/backend/$projectRel/target/site/jacoco/jacoco.xml --input-type jacoco --output coverage/$projectName-codeclimate.json;
242- echo "coverage generated: coverage/$projectName-codeclimate.json;"
243- else
244- echo $file does not match
245- fi
246- done
247-
248- # List all formatted files in coverage directory
249- - name : WHERE AM I - FORMATTED?
250- run : |
251- ls ${{ github.workspace }}/coverage
252- if : ${{ env.ACTION_DEBUG }}
253-
254- # Count of all total coverage files available
255- - name : Count files present
256- run : |
257- echo "FILE_COUNTER=$(ls -1q ./coverage | wc -l )" >> $GITHUB_ENV
258- #echo "::set-env name=FILE_COUNTER::$(ls -1q ./coverage | wc -l )"
259-
260- # Sum the coverage reports
261- - name : Summing the coverage reports generated
262- run : ./cc-test-reporter sum-coverage coverage/*-codeclimate.json -p ${{ env.FILE_COUNTER }} -o coverage/total-codeclimate.json
263-
264- # Upload JSON for debugging purposes
265- - name : Upload JSON for debugging purposes
266- uses : actions/upload-artifact@v4
267- with :
268- name : summed-java-coverage-report
269- path : coverage/total-codeclimate.json
270-
271- aggregation :
272- name : Aggregate Spring Boot and Javascript reports
273- needs : [yarn, spring-boot]
274- env :
275- CC_TEST_REPORTER_ID : 9ada3133fe9babf91a222009998b3545b7eae897a05900930bfa8a27fd82f385
276- runs-on : ubuntu-latest
277- steps :
278- # Get Code Climate binary
279- - name : Download Code Climate Binary
280- run : curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
281-
282- # Permissions applied to the Code Climate Executable
283- - name : Apply executable perms to Code Climate Binary
284- run : chmod +x ./cc-test-reporter
285-
286- # Before build
287- - name : Before build
288- run : ./cc-test-reporter before-build
289-
290- # Set required Git env vars for either pull request
291- - name : Set ENV for codeclimate (pull_request)
292- run : |
293- echo "GIT_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
294- echo "GIT_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
295- #echo "::set-env name=GIT_BRANCH::${{ github.event.pull_request.head.ref }}"
296- #echo "::set-env name=GIT_COMMIT_SHA::${{ github.event.pull_request.head.sha }}"
297- if : github.event_name == 'pull_request'
298-
299- # Set required Git env vars for a push to master
300- - name : Set ENV for codeclimate (push)
301- run : |
302- echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV
303- echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
304- #echo "::set-env name=GIT_BRANCH::$GITHUB_REF"
305- #echo "::set-env name=GIT_COMMIT_SHA::$GITHUB_SHA"
306- if : github.event_name == 'push'
307-
308- # Trimming the ref to master in order to publish correct report (paambaati)
309- - name : Set ref/head/master to master
310- run : |
311- echo "GIT_BRANCH=master" >> $GITHUB_ENV
312- #echo "::set-env name=GIT_BRANCH::master"
313- if : env.GIT_BRANCH == 'refs/heads/master'
314-
315- # Make Directory for downloaded files
316- - name : Make directory
317- run : mkdir coverage-reports
318-
319- # Download Spring-boot coverage report
320- - name : Download spring-boot coverage report
321- uses : actions/download-artifact@v4
322- with :
323- name : summed-java-coverage-report
324-
325- # See what is inside
326- - name : List items inside java coverage report object
327- run : |
328- ls
329-
330- # Copy total java to outside directory
331- - name : Copy Java Coverage to directory
332- run : |
333- cp total-codeclimate.json coverage-reports/total-java-codeclimate.json
334-
335- # Download Yarn coverage report
336- - name : Download javascript coverage report
337- uses : actions/download-artifact@v4
338- with :
339- name : summed-yarn-coverage-report
340-
341- # See what is inside
342- - name : List items inside javascript coverage report object
343- run : |
344- ls
345-
346- # Copy total Yarn to outside directory
347- - name : Copy Yarn Coverage to directory
348- run : |
349- cp total-codeclimate.json coverage-reports/total-yarn-codeclimate.json
350-
351- # See what is inside coverage
352- - name : List items inside java coverage report object
353- run : |
354- ls coverage-reports
355-
356- # Sum the coverage reports
357- - name : Summing the coverage reports generated
358- run : ./cc-test-reporter sum-coverage coverage-reports/*-codeclimate.json -p 2 -o coverage-reports/total-codeclimate.json
359-
360- # Upload JSON for debugging purposes
361- - name : Upload JSON for debugging purposes
362- uses : actions/upload-artifact@v4
363- with :
364- name : summed-total-coverage-report
365- path : coverage-reports/total-codeclimate.json
366-
367- # Upload total coverage report to Code Climate
368- - name : Upload coverage report to Code Climate
369- run : ./cc-test-reporter upload-coverage -d -i coverage-reports/total-codeclimate.json
0 commit comments