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

ci: Run only API tests affected by changes in PRs and Upgrade GHA runners #2867

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

novakzaballa
Copy link
Contributor

@novakzaballa novakzaballa commented Oct 19, 2023

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • [X ] I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Use pytest-testmon to only execute API tests affected by changed files. Also upgrade GHA runners for this specific job.

How did you test this code?

API Tests executed as expected. Also testing manually using this PR to ensure that only tests affected by changes are exectured.

Implementation notes

Notice that for retrieving the cache we use github.event.pull_request.base.sha as the final part of the cache key, and when we save the tesmon database file to the cache we use github.sha. That is because we restore cache only on PR events while we save the cache only on the push to main event, and github.event.pull_request.base.sha on the PR event context should be the same as github.sha of the base branch on the push event context.

Also, notice that we are using absolute paths for storing/retrieving the tesmon database file to/from the cache. We do that because if we use a relative path it will not be relative to the working directory, but to the workspace directory, which can vary depending on the context, so in this particular case I think it is better to stick to the absolute path. For more details refer to the comments below.

@vercel
Copy link

vercel bot commented Oct 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2023 6:23pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2023 6:23pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2023 6:23pm

@github-actions
Copy link
Contributor

github-actions bot commented Oct 19, 2023

Uffizzi Ephemeral Environment Deploying

☁️ https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/2867

⚙️ Updating now by workflow run 6644560383.

What is Uffizzi? Learn more!

@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b0ef013) 95.60% compared to head (e1098fb) 95.60%.
Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2867   +/-   ##
=======================================
  Coverage   95.60%   95.60%           
=======================================
  Files        1009     1009           
  Lines       28904    28910    +6     
=======================================
+ Hits        27634    27640    +6     
  Misses       1270     1270           

see 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot added the api Issue related to the REST API label Oct 22, 2023
@novakzaballa novakzaballa force-pushed the ci/optimize-tests-ci-automation branch from b231974 to 8e8a2a4 Compare October 22, 2023 16:53
@novakzaballa novakzaballa force-pushed the ci/optimize-tests-ci-automation branch from 8e8a2a4 to 269ac23 Compare October 22, 2023 22:29
@novakzaballa novakzaballa force-pushed the ci/optimize-tests-ci-automation branch from 269ac23 to 134ec81 Compare October 22, 2023 22:41
@novakzaballa novakzaballa force-pushed the ci/optimize-tests-ci-automation branch from 134ec81 to e03b732 Compare October 22, 2023 23:12
@novakzaballa novakzaballa force-pushed the ci/optimize-tests-ci-automation branch from 99836da to 0c2575d Compare October 24, 2023 15:48
@novakzaballa novakzaballa changed the title ci: Upgrade E2E and API tests runners and Optimize CI Tests -don't merge! ci: Run only tests affected by changes in PRs and Upgrade API tests runners Oct 24, 2023
@novakzaballa novakzaballa changed the title ci: Run only tests affected by changes in PRs and Upgrade API tests runners ci: Run only API tests affected by changes in PRs and Upgrade API tests runners Oct 24, 2023
@novakzaballa novakzaballa changed the title ci: Run only API tests affected by changes in PRs and Upgrade API tests runners ci: Run only API tests affected by changes in PRs and Upgrade GHA runners Oct 24, 2023
.github/workflows/api-pull-request.yml Show resolved Hide resolved
.github/workflows/api-pull-request.yml Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
@novakzaballa novakzaballa added this pull request to the merge queue Oct 26, 2023
Merged via the queue into main with commit bd3758d Oct 26, 2023
18 checks passed
@novakzaballa novakzaballa deleted the ci/optimize-tests-ci-automation branch October 26, 2023 16:35
novakzaballa added a commit that referenced this pull request Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants