44 workflow_dispatch : {}
55 push :
66 branches : ['test', 'cypress/*']
7+ pull_request :
8+ branches : ['dev']
79
810env :
911 DASHBOARD_PROJECT_ID : ${{ secrets.CY_DASHBOARD_PRJ_ID }}
2123 steps :
2224 - name : Build GWA API Image
2325 run : |
24- git clone https://github.com/bcgov/gwa-api.git
26+ git clone https://github.com/bcgov/gwa-api.git --branch v1.0.40
2527 cd gwa-api/microservices/gatewayApi
2628 docker build -t gwa-api:e2e .
2729
@@ -47,60 +49,50 @@ jobs:
4749
4850 - name : Execute Tests & Clean Up
4951 run : |
52+ # Start following logs in the background with continuous output
53+ docker logs -f cypress-e2e 2>&1 &
54+ LOG_PID=$!
55+
5056 while true; do
5157 if [ "$(docker ps -aq -f status=exited -f name=cypress-e2e)" ]; then
58+ echo "Cypress tests completed."
5259 # cleanup
5360 docker compose down
5461 break
5562 else
56- echo "Waiting for Cypress to Complete E2E Tests....."
57- sleep 1m
63+ sleep 30s
5864 fi
5965 done
6066
6167 - name : Upload E2E Test Results HTML Report
68+ if : always()
6269 uses : actions/upload-artifact@v4
6370 with :
6471 name : test-results-html
6572 path : ${{ github.workspace }}/e2e/results/report
6673
6774 - name : Upload E2E Test Results JSON Report
75+ if : always()
6876 uses : actions/upload-artifact@v4
6977 with :
7078 name : test-results-json
7179 path : ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json
7280
7381 - name : Upload E2E Code Coverage Report
82+ if : always()
7483 uses : actions/upload-artifact@v4
7584 with :
7685 name : code-coverage
7786 path : ${{ github.workspace }}/e2e/coverage
7887
79- - name : Instrument the code for coverage analysis
80- run : |
81- # Rewrite the paths as the coverage starts with '../app'!
82- sed -e 's/..\/app/./g' ./e2e/coverage/lcov.info > lcov.info
83-
84- #cd src
85- #npm install --legacy-peer-deps
86- #npx nyc instrument --compact=false . --in-place
87-
88- - name : SonarCloud Scan
89- uses : sonarsource/sonarcloud-github-action@master
88+ - name : Upload Astra scan results
89+ uses : actions/upload-artifact@v4
9090 with :
91- args : >
92- -Dsonar.organization=bcgov-oss
93- -Dsonar.projectKey=aps-portal-e2e
94- -Dsonar.host.url=https://sonarcloud.io
95- -Dsonar.projectBaseDir=src
96- -Dsonar.sources=.
97- -Dsonar.exclusions=nextapp/**,mocks/**,test/**,tools/**,*.json,*.js
98- -Dsonar.javascript.lcov.reportPaths=/github/workspace/lcov.info
99- env :
100- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
101- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
102-
91+ name : astra-scan-results
92+ path : ${{ github.workspace }}/e2e/cypress/fixtures/state/scanResult.json
93+
10394 - name : Check for failed tests and create Issue
95+ if : always()
10496 env :
10597 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
10698 run : |
@@ -122,6 +114,30 @@ jobs:
122114 exit 1
123115 fi
124116
117+ - name : Instrument the code for coverage analysis
118+ run : |
119+ # Rewrite the paths as the coverage starts with '../app'!
120+ sed -e 's/..\/app/./g' ./e2e/coverage/lcov.info > lcov.info
121+
122+ #cd src
123+ #npm install --legacy-peer-deps
124+ #npx nyc instrument --compact=false . --in-place
125+
126+ - name : SonarCloud Scan
127+ uses : sonarsource/sonarqube-scan-action@master
128+ with :
129+ args : >
130+ -Dsonar.organization=bcgov-oss
131+ -Dsonar.projectKey=aps-portal-e2e
132+ -Dsonar.host.url=https://sonarcloud.io
133+ -Dsonar.projectBaseDir=src
134+ -Dsonar.sources=.
135+ -Dsonar.exclusions=nextapp/**,mocks/**,test/**,tools/**,*.json,*.js
136+ -Dsonar.javascript.lcov.reportPaths=/github/workspace/lcov.info
137+ env :
138+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
139+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
140+
125141 - name : Set up Python 3.9
126142 if : failure()
127143 uses : actions/setup-python@v2
0 commit comments