Skip to content

Commit

Permalink
simplify to just check loading coverage / sonar scan
Browse files Browse the repository at this point in the history
  • Loading branch information
rustyjux committed Jan 28, 2025
1 parent a01bcf1 commit abef9d1
Show file tree
Hide file tree
Showing 2 changed files with 12,068 additions and 81 deletions.
84 changes: 3 additions & 81 deletions .github/workflows/aps-cypress-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,61 +19,16 @@ jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- name: Build GWA API Image
run: |
git clone https://github.com/bcgov/gwa-api.git
cd gwa-api/microservices/gatewayApi
docker build -t gwa-api:e2e .

- name: Checkout Portal
uses: actions/checkout@v2

- name: Build Docker Images
run: |
docker compose --profile testsuite build
- name: Spin up API Services Portal and Run E2E Tests
run: |
export CY_EXECUTION_ENV=${{ env.EXECUTION_ENV }}
export CY_RECORD_KEY=${{ env.DASHBOARD_RECORD_KEY }}
export CY_PROJECT_ID=${{ env.DASHBOARD_PROJECT_ID }}
export CY_COMMIT_BRANCH=${{ env.GIT_COMMIT_BRANCH }}
export CY_COMMIT_SHA=${{ env.GIT_COMMIT_SHA }}
export CY_COMMIT_AUTHOR=${{ env.GIT_COMMIT_AUTHOR }}
export CY_COMMIT_MESSAGE="${{ env.GIT_COMMIT_MESSAGE }}"
export CY_REPO_URL=${{ env.GIT_REPO_URL }}
export CY_COMMIT_AUTHOR_EMAIL=$(git --no-pager show -s --format='%ae' ${{ env.GIT_COMMIT_SHA }})
docker compose --profile testsuite up -d
- name: Execute Tests & Clean Up
run: |
while true; do
if [ "$(docker ps -aq -f status=exited -f name=cypress-e2e)" ]; then
# cleanup
docker compose down
break
else
echo "Waiting for Cypress to Complete E2E Tests....."
sleep 1m
fi
done
- name: Upload E2E Test Results Report
uses: actions/upload-artifact@v4
with:
name: test-results
path: ${{ github.workspace }}/e2e/results/report

- name: Upload E2E Code Coverage Report
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: ${{ github.workspace }}/e2e/coverage
fetch-depth: 0

- name: Instrument the code for coverage analysis
run: |
# Rewrite the paths as the coverage starts with '../app'!
sed -e 's/..\/app/./g' ./e2e/coverage/lcov.info > lcov.info
sed -e 's/..\/app/./g' ./e2e/lcov.info > lcov.info
#cd src
#npm install --legacy-peer-deps
Expand All @@ -94,37 +49,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Check for failed tests and create Issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
FAILURE_COUNT=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats.failures')
if [[ "$FAILURE_COUNT" -gt 0 ]]; then
FAILED_TESTS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.results | .[] | .suites | .[].tests | .[] | select(.fail==true) | .title')
STATS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats')
echo -e "Stats: $STATS\n\nFailed Tests:\n$FAILED_TESTS\n\nRun Link: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" > msg
export MSG=$(cat msg)
gh issue create --title "FAILED: Automated Tests($FAILURE_COUNT)" --body "$MSG" --label "automation" --assignee "${{ env.GIT_COMMIT_AUTHOR }}"
exit 1
fi
- name: Set up Python 3.9
if: failure()
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'

- name: Install Python dependencies
if: failure()
run: |
python -m pip install --upgrade pip
pip install requests
- name: Check Astra results and create Jira issue if necessary
if: failure()
run: python .github/astra-jira.py
env:
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }}
JIRA_API_KEY: ${{ secrets.JIRA_API_KEY }}
ASTRA_SCAN_RESULTS: ${{ github.workspace }}/e2e/cypress/fixtures/state/scanResult.json

Loading

0 comments on commit abef9d1

Please sign in to comment.