-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (53 loc) · 1.79 KB
/
main.yml
File metadata and controls
66 lines (53 loc) · 1.79 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
# This workflow will install Python dependencies, run tests, format and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Check out the repository
uses: actions/checkout@v4
# Step 2: Set up Python
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
# Step 3: Upgrade pip and install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
# Use pip to install from pyproject.toml
pip install ./avinda_shamal
# Step 4: Install Ruff for linting and formatting
- name: Install the code linting and formatting tool Ruff
run: pipx install ruff
# Step 5: Lint code with Ruff
- name: Lint code with Ruff
run: |
ruff check . --output-format=github --target-version=py39
# Step 6: Check code formatting with Ruff
- name: Check code formatting with Ruff
run: |
ruff format . --diff --target-version=py39
continue-on-error: true
# Step 7: Run tests with pytest
- name: Test with pytest
run: pytest avinda_shamal/test/unit/ --doctest-modules --junitxml=junit/test-results.xml
# Step 8: Upload the test results
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: junit/test-results.xml
if: ${{ always() }}