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

use github actions for pre-commit checks #1658

Merged
merged 5 commits into from Oct 5, 2022

Conversation

beniwohli
Copy link
Contributor

@beniwohli beniwohli commented Oct 4, 2022

What does this pull request do?

Recently, a new release of importlib-metadata broke our pre-commit setup on Jenkins. The issue is that we run pre-commit in a Python 3.7 docker container. However, we can't use a more recent Python image, as that won't work with the deprecated pre-commit install script we use.

When we had issues with pre-commit/linting the last time, we discussed using a Github Action instead. This PR implements this.

@apmmachine
Copy link
Collaborator

apmmachine commented Oct 4, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-10-05T08:18:31.885+0000

  • Duration: 32 min 0 sec

Test stats 🧪

Test Results
Failed 0
Passed 5029
Skipped 3378
Total 8407

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /test linters : Run the Python linters only.

  • /test full : Run the full matrix of tests.

  • /test benchmark : Run the APM Agent Python benchmarks tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@apmmachine
Copy link
Collaborator

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (67/67) 💚
Files 100.0% (227/227) 💚
Classes 100.0% (227/227) 💚
Lines 91.3% (18070/19792) 👍
Conditionals 74.607% (2800/3753) 👍

@beniwohli beniwohli requested review from basepi and a team October 4, 2022 13:12
Copy link
Contributor

@basepi basepi left a comment

Choose a reason for hiding this comment

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

Looks great. Once we merge this (probably with admin privs) we'll want to update the branch protections to target the new test.

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
rev: 3.9.2
Copy link
Contributor

Choose a reason for hiding this comment

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

why not latest? 5.0.4

And we should target github, not their mirror on gitlab.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, updated in 7823421

Copy link
Contributor

Choose a reason for hiding this comment

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

to avoid have to check for new version you can add .github/dependabot.yaml file like this one

version: 2
updates:
# GitHub actions dependencies
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"
# Python dependencies (Optional)
  - package-ecosystem: "pip"
    directory: "/"
    schedule:
      interval: "weekly"

Copy link
Contributor Author

@beniwohli beniwohli Oct 6, 2022

Choose a reason for hiding this comment

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

@kuisathaverat from what I can tell, dependabot doesn't support updating the pre-commit hook versions themselves: dependabot/dependabot-core#1524

Copy link
Contributor

Choose a reason for hiding this comment

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

but keep GitHub Actions versions updated .github/workflows/pre-commit.yml

@basepi basepi merged commit 74db326 into elastic:main Oct 5, 2022
APM-Agents (OLD) automation moved this from In Progress to Done Oct 5, 2022
@beniwohli beniwohli deleted the pre-commit-gh-action branch October 6, 2022 09:47
v1v added a commit to v1v/apm-agent-python that referenced this pull request Oct 11, 2022
…ith-k8s-skaffold

* upstream/main:
  bump python versions and use docker slim versions (elastic#1661)
  use github actions for pre-commit checks (elastic#1658)
  Use typing.TypeVar on decorators' type hints (elastic#1655)
  Use minimum of 5 seconds for interval between central config calls (elastic#1652)
  fix errors in pymongo tests introduced in elastic#1639 (elastic#1648)
  only use content-type and content-encoding headers for POSTing events (elastic#1651)
  fix starlette 0.21 tests (elastic#1653)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants