Skip to content

Commit

Permalink
use github actions for pre-commit checks (elastic#1658)
Browse files Browse the repository at this point in the history
* use github actions for pre-commit checks

* remove pre-commit run from Jenkins

* remove linting CI job

* use correct repo and newest version of flake8

thanks @basepi for the heads-up
  • Loading branch information
beniwohli committed Oct 5, 2022
1 parent c86c5e8 commit 74db326
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 132 deletions.
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
Original file line number Diff line number Diff line change
@@ -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
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
exclude: elasticapm\/utils\/wrapt
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
exclude: elasticapm\/utils\/wrapt|build|src|tests|dist|conftest.py|setup.py
Expand Down
29 changes: 0 additions & 29 deletions Jenkinsfile
Original file line number Diff line number Diff line change
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

0 comments on commit 74db326

Please sign in to comment.