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

TMEDIA-580 test only changed files on push and in actions #1210

Merged
merged 15 commits into from
Jan 7, 2022

Conversation

JackHowa
Copy link
Contributor

@JackHowa JackHowa commented Jan 4, 2022

Description

Test locally only changed files on push* to improve dev productivity

Jira Ticket

Acceptance Criteria

  • On developer push locally, testing should only occur on files that changed vs canary base branch
  • GitHub Actions run on changed as well rather than all of the tests on prs to canary only

Test Steps

  1. Checkout this branch git checkout TMEDIA-580-test-commit-changed
  2. Reinstall your deps rm -rf node_modules && npm i for new jest version
  3. In one file, like byline, break the tests: const ArticleByline = () => <Byline font="Primary" />; -> const ArticleByline = () => <p>by</p>;
  4. stage the file git add blocks/byline-block/features/byline/default.jsx
  5. Commit the file git commit -m "only byline"
  6. Break the tests of another file
  7. Add the file and commit the file
  8. Try to git push. See the linting run (deferred to future ticket). See the only files changed are being tested. This should fail
  9. To reset your branch to mine, run git reset --hard origin/TMEDIA-580-test-commit-changed

Effect Of Changes

Before

  • On push, every test is run, taking minutes
  • Github actions test take a long time

After

Dependencies or Side Effects

Author Checklist

The author of the PR should fill out the following sections to ensure this PR is ready for review.

  • Confirmed all the test steps a reviewer will follow above are working.
  • Confirmed there are no linter errors. Please run npm run lint to check for errors. Often, npm run lint:fix will fix those errors and warnings. -> na
  • Ran this code locally and checked that there are not any unintended side effects. For example, that a CSS selector is scoped only to a particular block. -> na
  • Confirmed this PR has reasonable code coverage. You can run npm run test:coverage to see your progress.
    • Confirmed this PR has unit test files
    • Ran npm run test, made sure all tests are passing
    • If the amount of work to write unit tests for this change are excessive,
      please explain why (so that we can fix it whenever it gets refactored). -> na
  • Confirmed relevant documentation has been updated/added.

Reviewer Checklist

The reviewer of the PR should copy-paste this template into the review comments on review.

  • Linting code actions have passed.
  • Ran the code locally based on the test instructions.
    • I don’t think this is needed to be tested locally. For example, a padding style change (storybook?) or a logic change (write a test).
  • I am a member of the engine theme team so that I can approve and merge this. If you're not on the team, you won't have access to approve and merge this pr.
  • Looked to see that the new or changed code has code coverage, specifically. We want the global code coverage to keep on going up with targeted testing.

@JackHowa JackHowa requested a review from a team as a code owner January 4, 2022 15:56
@JackHowa JackHowa changed the title TMEDIA-580 test on commit locally only changed files (pt 1) BLOCKED TMEDIA-580 test on commit locally only changed files (pt 1) Jan 4, 2022
@JackHowa JackHowa changed the title BLOCKED TMEDIA-580 test on commit locally only changed files (pt 1) TMEDIA-580 test only changed files on push and in actions Jan 4, 2022
@JackHowa JackHowa changed the title TMEDIA-580 test only changed files on push and in actions IN PROGRESS PENDING DISCUSSION TMEDIA-580 test only changed files on push and in actions Jan 4, 2022
@JackHowa JackHowa changed the title IN PROGRESS PENDING DISCUSSION TMEDIA-580 test only changed files on push and in actions TMEDIA-580 test only changed files on push and in actions Jan 6, 2022
Copy link
Contributor

@matthewroach matthewroach left a comment

Choose a reason for hiding this comment

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

Couple of small name changes to remove "news theme" references

.github/workflows/test-coverage-blocks-canary.yml Outdated Show resolved Hide resolved
.github/workflows/test-coverage-blocks.yml Outdated Show resolved Hide resolved
@JackHowa
Copy link
Contributor Author

JackHowa commented Jan 7, 2022

Good call @matthewroach -- updated

@JackHowa JackHowa requested a review from matthewroach January 7, 2022 15:14
@JackHowa JackHowa merged commit 8a03344 into canary Jan 7, 2022
@JackHowa JackHowa deleted the TMEDIA-580-test-commit-changed branch January 7, 2022 15:22
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