Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor GitHub Actions workflow for improved testing and caching #10

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

Gkrumbach07
Copy link
Owner

  • Renamed job from 'Tests' to 'Setup' for clarity.
  • Consolidated Node.js modules caching for frontend and backend.
  • Added steps for linting and unit tests with caching.
  • Introduced a new job 'Get-Test-Groups' to dynamically set test groups.
  • Enhanced Cypress testing with grouped test execution and improved artifact naming.
  • Ensured cache restoration for all relevant directories.

This update streamlines the CI process and enhances test organization.

Description

How Has This Been Tested?

Test Impact

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

- Renamed job from 'Tests' to 'Setup' for clarity.
- Consolidated Node.js modules caching for frontend and backend.
- Added steps for linting and unit tests with caching.
- Introduced a new job 'Get-Test-Groups' to dynamically set test groups.
- Enhanced Cypress testing with grouped test execution and improved artifact naming.
- Ensured cache restoration for all relevant directories.

This update streamlines the CI process and enhances test organization.
- Added conditional logic to handle cases where the mocked test directory may not exist, defaulting to 'default' group if necessary.
- Updated Cypress test execution to run all tests when the test group is 'default', or specific tests based on the group otherwise.
- Improved output handling for test groups to ensure proper execution flow.

This update improves the robustness of the CI process by ensuring tests are executed correctly based on available test groups.
- Added detailed logging to check for the existence of the mocked tests directory and its contents.
- Implemented fallback logic to default to 'default' test group if no mocked tests are found.
- Improved output handling to display final test group results.

This update increases the robustness of the CI process by ensuring proper handling of test groups and providing clearer feedback during execution.
- Updated the logic for generating test groups to use 'find' instead of 'ls' for improved accuracy in locating directories.
- Enhanced the fallback condition to handle cases where the generated groups are empty or not found, ensuring a default group is always available.
- Improved logging to provide clearer output regarding the generated test groups.

This update enhances the reliability of the CI process by ensuring proper detection and handling of test groups.
- Deleted the `application.cy.ts` test file, which contained various tests for application access and UI behavior.
- This removal is part of a cleanup effort to streamline the test suite and eliminate outdated or redundant tests.

This update helps maintain a more efficient and relevant testing framework.l
- Updated the logic for generating test groups in the Cypress testing workflow to use 'ls' and 'grep' instead of 'find' for improved clarity and performance.
- This change enhances the accuracy of directory detection and maintains the robustness of the CI process by ensuring proper handling of test groups.

This update contributes to a more efficient and reliable testing framework.
- Updated the logic for generating test groups in the Cypress testing workflow to utilize 'find' for improved accuracy and clarity.
- Enhanced the command to ensure proper directory detection and output formatting, resulting in a more reliable CI process.

This update contributes to a more efficient and robust testing framework.
- Added debug logging to the test group generation process for better visibility into command execution.
- Improved the directory navigation and command execution steps, providing clearer output at each stage.
- Ensured robust handling of test groups with fallback logic if no groups are found, maintaining the reliability of the CI process.

This update contributes to a more transparent and efficient testing framework.
- Updated the JSON array creation for test groups to use compact output with jq, improving efficiency.
- Enhanced output formatting for GitHub Actions to ensure correct handling of test groups.
- Improved logging for better visibility into the test group generation process.

This update contributes to a more efficient and reliable testing framework.
- Changed the linting step to run both linting and formatting checks using 'npm run test:fix' for improved code quality.
- Updated Cypress test execution commands to use 'npm run test:cypress-ci' for consistency and clarity in CI environments.
- Ensured that the test execution logic remains robust while providing clearer output for different test groups.

This update enhances the efficiency and reliability of the testing framework.
- Updated the test execution command to reflect the new directory structure, ensuring consistency in test paths.
- Removed the upload coverage reports step and artifact upload, streamlining the workflow for improved clarity and efficiency.
- Adjusted the working directory for Cypress tests to enhance organization and maintainability.

This update simplifies the CI process while maintaining the integrity of the testing framework.
Copy link

@antowaddle antowaddle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gkrumbach07 I've added a few comments, there's a few things missing also:

  • Codecov - seems like that has been removed, was that for testing purposes?
  • Cypress Results - assuming Codecov is added back, the results need to be consolidated and then read by Codecov.

Overall, I kind of prefer this approach vs my containerised approach albeit the result and execution time will be the same.

echo "test-groups=[\"default\"]" >> "$GITHUB_OUTPUT"
fi

Cypress-Tests:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to Cypress-Mock-Tests? In the future we may also want to include e2e Cypress tests in this workflow.

fi

Cypress-Tests:
needs: [Setup, Get-Test-Groups]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also require the Unit-Tests to pass successfully in order to execute the Mocks? If any of the Unit tests there is a possibility that the mocks would also fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants