Skip to content

Commit bf6c29d

Browse files
authored
Update unit-tests.yml
1 parent af46aa3 commit bf6c29d

File tree

1 file changed

+21
-30
lines changed

1 file changed

+21
-30
lines changed

.github/workflows/unit-tests.yml

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,52 @@
1-
name: toolkit-unit-tests
1+
name: Unit tests
22

33
on:
44
push:
55
branches:
66
- main
7-
paths-ignore:
8-
- '**.md'
97
pull_request:
10-
paths-ignore:
11-
- '**.md'
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
checks: write
1214

1315
jobs:
14-
build:
15-
name: Build and Test
16-
strategy:
17-
matrix:
18-
runs-on: [ubuntu-latest, macos-latest, windows-latest]
19-
python-version: ['3.9', '3.10', '3.11'] # Матрица версий Python
20-
fail-fast: false
21-
runs-on: ${{ matrix.runs-on }}
16+
test:
17+
runs-on: ubuntu-latest
2218

2319
steps:
24-
- name: Checkout
20+
- name: Checkout code
2521
uses: actions/checkout@v3
2622

27-
- name: Set up Python ${{ matrix.python-version }}
23+
- name: Set up Python
2824
uses: actions/setup-python@v4
2925
with:
30-
python-version: ${{ matrix.python-version }}
26+
python-version: '3.9'
3127

3228
- name: Install dependencies
3329
run: |
3430
python -m pip install --upgrade pip
3531
if [ -f "requirements.txt" ]; then
36-
pip install -r requirements.txt
32+
pip install -r requirements.txt || { echo "Dependency installation failed!"; exit 1; }
3733
else
3834
echo "requirements.txt not found! Skipping dependency installation."
3935
fi
4036
41-
- name: Lint with flake8
37+
- name: Run unit tests
4238
run: |
43-
if [ -f "setup.cfg" ] || [ -f ".flake8" ]; then
44-
pip install flake8
45-
flake8 .
46-
else
47-
echo "No lint configuration found! Skipping linting."
48-
fi
39+
pytest --junitxml=test-results.xml || true
40+
id: run-tests
4941

50-
- name: Run unit tests
42+
- name: Check test results
43+
if: steps.run-tests.outcome == 'failure'
5144
run: |
52-
pip install pytest
53-
pytest --junitxml=test-results.xml
54-
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Для доступа к секретам, если нужны
45+
echo "Tests failed! Review the logs for details."
46+
exit 1
5647
5748
- name: Upload test results
58-
if: always() # Выполнить этот шаг всегда, независимо от успеха предыдущих шагов
49+
if: always()
5950
uses: actions/upload-artifact@v4
6051
with:
6152
name: test-results

0 commit comments

Comments
 (0)