Skip to content

Commit 4a9532c

Browse files
committed
CI Refactor: Split workflows and add install check
- Split monolithic python-package.yml into: - lint.yml (flake8, pycodestyle, pydocstyle) - tests.yml (unit tests with parallel execution) - Added install_check.yml to verify 'pip install .' works on branches and releases
1 parent fd8817d commit 4a9532c

File tree

4 files changed

+104
-44
lines changed

4 files changed

+104
-44
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Install from Source Check
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
install-test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ['3.8', '3.9', '3.10', '3.11']
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install from source
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install .
30+
31+
- name: Verify installation
32+
run: |
33+
# Change directory to ensure we test the installed package, not the local source
34+
mkdir test_install
35+
cd test_install
36+
python -c "
37+
import delayed_assert
38+
print(f'Successfully imported delayed_assert from {delayed_assert.__file__}')
39+
from delayed_assert import expect, assert_expectations
40+
expect(1 == 1)
41+
assert_expectations()
42+
print('Basic functionality verification passed')
43+
"

.github/workflows/lint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Linting
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python 3.9
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.9
18+
- name: Install linters
19+
run: |
20+
python -m pip install --upgrade pip
21+
python -m pip install flake8 pycodestyle pydocstyle
22+
- name: Lint with flake8
23+
run: |
24+
# stop the build if there are Python syntax errors or undefined names
25+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
26+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
27+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
28+
- name: Lint with pycodestyle
29+
run: pycodestyle delayed_assert/
30+
- name: Lint with pydocstyle
31+
run: pydocstyle delayed_assert/

.github/workflows/python-package.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: [3.8, 3.9, '3.10', '3.11']
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
python -m pip install pytest pytest-xdist
27+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
28+
- name: Run tests (Parallel)
29+
run: |
30+
pytest -n auto

0 commit comments

Comments
 (0)