Skip to content

Commit 8eef496

Browse files
authored
Update python-package.yml
1 parent ddee4b5 commit 8eef496

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

‎.github/workflows/python-package.yml‎

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ name: Python package
55

66
on:
77
push:
8-
branches: [ "master" ]
8+
branches: [ "master", "main" ]
99
pull_request:
10-
branches: [ "master" ]
10+
branches: [ "master", "main" ]
11+
workflow_dispatch:
1112

1213
jobs:
1314
build:
@@ -16,25 +17,43 @@ jobs:
1617
strategy:
1718
fail-fast: false
1819
matrix:
19-
python-version: ["3.9", "3.10", "3.11"]
20+
python-version: ["3.9", "3.10", "3.11", "3.12"]
2021

2122
steps:
2223
- uses: actions/checkout@v4
24+
2325
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v3
26+
uses: actions/setup-python@v5
2527
with:
2628
python-version: ${{ matrix.python-version }}
29+
2730
- name: Install dependencies
2831
run: |
2932
python -m pip install --upgrade pip
30-
python -m pip install flake8 pytest
3133
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
34+
python -m pip install flake8 pytest pytest-cov black mypy
35+
3236
- name: Lint with flake8
3337
run: |
3438
# stop the build if there are Python syntax errors or undefined names
3539
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
40+
# exit-zero treats all errors as warnings
3741
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38-
- name: Test with pytest
42+
43+
- name: Check code formatting with black
3944
run: |
40-
pytest
45+
black --check --diff . || true
46+
47+
- name: Run tests with pytest
48+
run: |
49+
pytest --cov=. --cov-report=xml || true
50+
51+
- name: Verify Python scripts run without errors
52+
run: |
53+
echo "Testing basic Python scripts..."
54+
python quick_start.py
55+
python 01-basics/hello_world.py
56+
python 01-basics/variables.py
57+
python 02-data-types/lists.py
58+
python 04-functions/basics.py
59+
echo "All scripts executed successfully!"

0 commit comments

Comments
 (0)