-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ci/cd pipeline to check python lint and airflow
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: python static checks and tests | ||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
jobs: | ||
testing: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Setup Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.12.6 | ||
architecture: x64 | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
run: echo "::set-output name=files::$(git diff --name-only ${{ github.sha }} ${{ github.event.before }})" | ||
|
||
- name: Extract directories | ||
id: extract-dirs | ||
run: echo "::set-output name=dirs::$(echo '${{ steps.changed-files.outputs.files }}' | xargs -n1 dirname | sort -u)" | ||
|
||
- name: Install Flake8 | ||
run: pip install flake8 | ||
|
||
- name: Run Flake8 | ||
run: | | ||
for dir in ${{ steps.extract-dirs.outputs.dirs }}; do | ||
flake8 $dir | ||
done | ||
- name: Install Pylint | ||
run: pip install pylint | ||
|
||
- name: Run Pylint | ||
run: | | ||
for dir in ${{ steps.extract-dirs.outputs.dirs }}; do | ||
find $dir -name "*.py" | xargs pylint --output-format=colorized | ||
done | ||
- name: Install Black | ||
run: pip install black | ||
|
||
- name: Run Black | ||
run: | | ||
for dir in ${{ steps.extract-dirs.outputs.dirs }}; do | ||
find $dir -name "*.py" | xargs black --check | ||
done | ||
- name: Install dependencies | ||
run: pip install apache-airflow pytest | ||
|
||
- name: Test DAG integrity | ||
run: | | ||
for dir in ${{ steps.extract-dirs.outputs.dirs }}; do | ||
pytest $dir/tests/ | ||
done |