forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added steps to amalgamate results of Unit and Cypress tests. Also add…
…ed Codecov back.
- Loading branch information
1 parent
3acf604
commit ca07d8c
Showing
1 changed file
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
name: Test | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
Setup: | ||
runs-on: ubuntu-latest | ||
|
@@ -62,6 +61,11 @@ jobs: | |
key: ${{ runner.os }}-18.x-modules-${{ hashFiles('**/package-lock.json') }} | ||
- name: Run unit tests | ||
run: npm run test:unit | ||
- name: Upload unit test coverage | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: unit-coverage | ||
path: ./frontend/coverage | ||
|
||
Get-Test-Groups: | ||
runs-on: ubuntu-latest | ||
|
@@ -95,7 +99,7 @@ jobs: | |
echo "test-groups=[\"default\"]" >> "$GITHUB_OUTPUT" | ||
fi | ||
Cypress-Tests: | ||
Cypress-Mock-Tests: | ||
needs: [Setup, Get-Test-Groups, Unit-Tests] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
|
@@ -113,11 +117,52 @@ jobs: | |
${{ github.workspace }}/backend/node_modules | ||
${{ github.workspace }}/frontend/node_modules | ||
key: ${{ runner.os }}-18.x-modules-${{ hashFiles('**/package-lock.json') }} | ||
- name: Run Cypress tests | ||
- name: Run Cypress Mock tests | ||
run: | | ||
if [ "${{ matrix.test-group }}" == "default" ]; then | ||
npm run test:cypress-ci | ||
else | ||
npm run test:cypress-ci -- --spec "src/__tests__/cypress/cypress/tests/mocked/${{ matrix.test-group }}/**/*" | ||
fi | ||
working-directory: ./frontend | ||
working-directory: ./frontend | ||
- name: Upload Cypress Mock results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cypress-results-${{ matrix.test-group }} | ||
path: ./frontend/src/__tests__/cypress/results/mocked | ||
|
||
Combine-Results-and-Upload: | ||
needs: [Unit-Tests, Cypress-Mock-Tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: all-artifacts | ||
- name: Combine coverage reports | ||
run: | | ||
mkdir -p ./frontend/coverage | ||
cp -R all-artifacts/unit-coverage/* ./frontend/coverage/ | ||
find all-artifacts -name "mocked" -type d | while read dir; do | ||
cp -R "$dir"/* ./frontend/coverage/ | ||
done | ||
- name: Upload combined results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: combined-test-results | ||
path: ./frontend/coverage/ | ||
- name: Upload coverage to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: false | ||
name: frontend | ||
directory: ./frontend/coverage | ||
verbose: true | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: cypress-results | ||
path: ./frontend/src/__tests__/cypress/results/ | ||
|