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
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 0 additions & 44 deletions .ci/jobs/apm-agent-python-linting-mbp.yml

This file was deleted.

55 changes: 0 additions & 55 deletions .ci/linting.groovy

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
@@ -1,15 +1,16 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.7.0
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 22.3.0
rev: 22.8.0
hooks:
- id: black
language_version: python3
exclude: elasticapm\/utils\/wrapt
- 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

hooks:
- id: flake8
exclude: elasticapm\/utils\/wrapt|build|src|tests|dist|conftest.py|setup.py
Expand Down
29 changes: 0 additions & 29 deletions Jenkinsfile
Expand Up @@ -67,35 +67,6 @@ pipeline {
}
}
}
stage('Sanity checks') {
when {
beforeAgent true
allOf {
expression { return env.ONLY_DOCS == "false" }
anyOf {
not { changeRequest() }
expression { return params.Run_As_Main_Branch }
}
}
}
environment {
PATH = "${env.WORKSPACE}/.local/bin:${env.WORKSPACE}/bin:${env.PATH}"
}
steps {
withGithubNotify(context: 'Sanity checks', tab: 'tests') {
deleteDir()
unstash 'source'
script {
docker.image('python:3.7-stretch').inside(){
dir("${BASE_DIR}"){
// registry: '' will help to disable the docker login
preCommit(commit: "${GIT_BASE_COMMIT}", junit: true, registry: '')
}
}
}
}
}
}
/**
Execute unit tests.
*/
Expand Down