forked from numinouslabs/numinous
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (65 loc) · 2.53 KB
/
pull-request.yml
File metadata and controls
82 lines (65 loc) · 2.53 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Pull Request
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pull-request:
runs-on: ubuntu-latest
steps:
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Checkout code
uses: actions/checkout@v4
- name: Check for Large Files
run: |
echo "::notice::Check for Large Files"
bash ./.github/scripts/check-large-files.sh
- name: Lint GH actions
uses: reviewdog/action-actionlint@v1
with:
reporter: github-check
fail_level: error
- name: Extract Python minor version
run: |
VERSION=${{ steps.setup-python.outputs.python-version }}
VERSION_FORMATTED=$(echo $VERSION | cut -d '.' -f 1,2)
echo "python-version=${{ steps.setup-python.outputs.python-version }}"
echo "python_version_formatted=$VERSION_FORMATTED" >> $GITHUB_ENV
echo "Formatted Python minor version: $VERSION_FORMATTED"
- name: Restore cached dependencies
uses: actions/cache/restore@v4
with:
path: |
/opt/hostedtoolcache/Python/${{ steps.setup-python.outputs.python-version }}/x64/lib/python${{ env.python_version_formatted }}/site-packages
/opt/hostedtoolcache/Python/${{ steps.setup-python.outputs.python-version }}/x64/bin
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-
- name: Install packages
run: pip install -r requirements_dev.txt
- name: Format
run: |
# Imports order
echo "::notice::Imports order"
isort --check-only --diff .
# Code format
echo "::notice::Code format"
black --check .
# requirements.txt are sorted
echo "::notice::requirements.txt are sorted"
diff <(sort requirements.txt) requirements.txt
# requirements_dev.txt are sorted
echo "::notice::requirements_dev.txt are sorted"
diff <(sort requirements_dev.txt) requirements_dev.txt
- name: Lint
run: |
flake8 .
- name: Tests
run: |
coverage run --source=./ --omit="tests/*,*/tests/*" -m pytest -v
coverage report -m