Skip to content

Commit 7d3b75e

Browse files
authored
Merge pull request #68 from numpy/ci/lint-as-own-step
TST: Make linting own step in CI pipeline
2 parents 3e8a716 + 3a5b7ea commit 7d3b75e

File tree

2 files changed

+52
-7
lines changed

2 files changed

+52
-7
lines changed

.github/workflows/lint.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
pull_request:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read # to fetch code (actions/checkout)
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
test_lint:
20+
name: Lint
21+
# If using act to run CI locally the github object does not exist and the usual skipping should not be enforced
22+
if: "github.repository == 'numpy/numpy-financial' || github.repository == ''"
23+
runs-on: ubuntu-22.04
24+
strategy:
25+
matrix:
26+
python-version: ['3.11']
27+
28+
steps:
29+
- uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
submodules: recursive
33+
34+
- name: Setup Python
35+
uses: actions/setup-python@v4
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
39+
- name: Install Python packages
40+
run: |
41+
python -m pip install --upgrade pip poetry
42+
poetry env use ${{ matrix.python-version }}
43+
poetry install --with=test --with=lint
44+
45+
- name: Lint with flake8
46+
run: |
47+
set -euo pipefail
48+
# stop the build if there are Python syntax errors or undefined names
49+
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
50+
# The GitHub editor is 127 chars wide
51+
poetry run flake8 . --ignore=F401,F403,W503,E226 --count --max-complexity=10 --max-line-length=127 --statistics

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ jobs:
1919
run: |
2020
python -m pip install --upgrade pip poetry
2121
poetry env use ${{ matrix.python-version }}
22-
poetry install --with=test --with=lint
23-
- name: Lint with flake8
24-
run: |
25-
# stop the build if there are Python syntax errors or undefined names
26-
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
27-
# The GitHub editor is 127 chars wide
28-
poetry run flake8 . --ignore=F401,F403,W503,E226 --count --max-complexity=10 --max-line-length=127 --statistics
22+
poetry install --with=test
2923
- name: Test with pytest
3024
run: |
3125
poetry run pytest

0 commit comments

Comments
 (0)