-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (45 loc) · 1.31 KB
/
ci.yml
File metadata and controls
47 lines (45 loc) · 1.31 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
name: CI
on:
push:
branches: [ main ]
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Detect comment-only changes
id: changes
run: |
git fetch --depth=2 origin ${{ github.base_ref }}
CHANGED=$(git diff --name-only HEAD origin/${{ github.base_ref }} -- '*.py')
if [ -z "$CHANGED" ]; then
echo "run=false" >> $GITHUB_OUTPUT
else
DIFF=$(git diff origin/${{ github.base_ref }} HEAD -- '*.py' | grep '^+' | grep -v '+++' | grep -v '^+\s*#')
if [ -z "$DIFF" ]; then
echo "run=false" >> $GITHUB_OUTPUT
else
echo "run=true" >> $GITHUB_OUTPUT
fi
fi
- name: Install dependencies
if: steps.changes.outputs.run == 'true'
run: |
python -m pip install --upgrade pip
pip install -e .
pip install flake8
- name: Run flake8
if: steps.changes.outputs.run == 'true'
run: flake8 .
- name: Run pytest
if: steps.changes.outputs.run == 'true'
run: pytest