-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (54 loc) · 2.13 KB
/
Copy pathpython-app.yml
File metadata and controls
59 lines (54 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
detect-changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
python_code: ${{steps.diff_check.outputs.python_code}}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.base_ref }}
- uses: actions/checkout@v7
with:
clean: false
- name: Generate diffs
id: diff_check
run: |
git branch -a --list | cat
PYTHON_CODE_CHANGES=$(git diff --compact-summary origin/${{ github.base_ref }} -- routingfilter routing_test.py test_data pyproject.toml .github/workflows/python-app.yml .github/configurations | wc -l)
echo "python_code=$PYTHON_CODE_CHANGES" >> "$GITHUB_OUTPUT"
build:
runs-on: ubuntu-24.04
needs: [ "detect-changes" ]
if: ${{ needs.detect-changes.outputs.python_code > 0 }}
steps:
- uses: actions/checkout@v7
- name: Set up Python
id: setup_python
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Show which copy is under test
run: python -c "import pathlib, routingfilter; print(pathlib.Path(routingfilter.__file__).resolve())"
- name: "Lint with black"
run: black ./routingfilter --config .github/configurations/python_linters/.black --check --diff
- name: Lint with flake8
run: flake8 ./routingfilter --config .github/configurations/python_linters/.flake8 --show-source
- name: "Isort check"
run: isort ./routingfilter --sp .github/configurations/python_linters/.isort.cfg --profile black --filter-files --check-only --diff
- name: Test with pytest
run: python -m pytest routing_test.py