1- name : Test & Build
1+ name : Lint, Test & Build
22
33on :
44 push :
77
88jobs :
99 lint :
10- name : Python Linux (flake8)
11- runs-on : ubuntu-latest
12-
10+ name : Lint
11+ timeout-minutes : 20
12+ strategy :
13+ fail-fast : true
14+ matrix :
15+ os : [ ubuntu-latest ]
16+ python-version : [ '3.10' ]
17+ runs-on : ${{ matrix.os }}
1318 steps :
1419 - name : Checkout Repository
1520 uses : actions/checkout@v4
1621
17- - name : Setup Python
22+ - name : Set up Python
1823 uses : actions/setup-python@v5
1924 with :
20- python-version : ' 3.10 '
25+ python-version : ${{ matrix.python-version }}
2126
2227 - name : Install Dependencies
2328 run : |
2429 python -m pip install --upgrade pip
2530 pip install flake8
2631
2732 - name : Run Lint
28- run : flake8 --verbose --color auto --count --statistics --format=json --output-file=flake8-report.json || echo "::set-output name=flake8_failed::true"
29- continue-on-error : true
33+ run : |
34+ flake8 --verbose --color auto --count --statistics --format=default --output-file=flake8-report
3035
3136 - name : Upload Report
3237 if : ${{ always() }}
3338 uses : actions/upload-artifact@v4
3439 with :
35- name : flake8-report
36- path : flake8-report.json
37-
38- build_and_test :
39- name : Build and Test
40- runs-on : ubuntu-latest
41- needs : lint
40+ name : lint-report-${{ matrix.python-version }}-${{ matrix.os }}
41+ path : flake8-report
4242
43+ test :
44+ name : Test
45+ timeout-minutes : 20
46+ strategy :
47+ fail-fast : true
48+ matrix :
49+ os : [ ubuntu-latest, windows-latest, macos-latest ]
50+ python-version : [ '3.10', '3.11', '3.12' ]
51+ runs-on : ${{ matrix.os }}
52+ needs : lint
4353 steps :
4454 - name : Checkout Repository
4555 uses : actions/checkout@v4
4656
47- - name : Setup Python
57+ - name : Set up Python
4858 uses : actions/setup-python@v5
4959 with :
50- python-version : ' 3.10 '
60+ python-version : ${{ matrix.python-version }}
5161
5262 - name : Install Dependencies
5363 run : |
5464 python -m pip install --upgrade pip
55- pip install setuptools wheel
65+ pip install pytest
66+ pip install -r requirements.txt
5667
57- - name : Install Pytest
68+ - name : Run Tests
5869 run : |
59- pip install pytest
70+ pytest tests -vv -rEPW -o pytest_collection_order=alphabetical --cache-clear --color=yes
71+
72+ build :
73+ name : Build
74+ timeout-minutes : 20
75+ strategy :
76+ fail-fast : true
77+ matrix :
78+ os : [ ubuntu-latest, windows-latest, macos-latest ]
79+ python-version : [ '3.10' ]
80+ runs-on : ${{ matrix.os }}
81+ needs : test
82+ steps :
83+ - name : Checkout Repository
84+ uses : actions/checkout@v4
85+
86+ - name : Set up Python
87+ uses : actions/setup-python@v5
88+ with :
89+ python-version : ${{ matrix.python-version }}
90+
91+ - name : Install Dependencies
92+ run : |
93+ python -m pip install --upgrade pip
94+ pip install setuptools wheel
6095
6196 - name : Build Package
6297 run : |
6398 python setup.py sdist
6499
65- - name : Install Package
100+ - name : Get Package Name (Windows)
101+ if : matrix.os == 'windows-latest'
66102 run : |
67- pip install dist/*
103+ $path_separator = "\\"
104+ $latestFile = Get-ChildItem -Path "dist\\" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
105+ Write-Host "Latest file: $latestFile"
106+ Write-Output "PACKAGE_NAME=dist$path_separator$($latestFile.Name)" | Out-File -FilePath $env:GITHUB_ENV -Append
68107
69- - name : Run Tests
108+ - name : Get Package Name (Ubuntu and macOS)
109+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
110+ run : |
111+ path_separator="/"
112+ latestFile=$(ls -t dist/ | head -n 1)
113+ echo "Latest file: $latestFile"
114+ echo "PACKAGE_NAME=dist$path_separator$latestFile" >> $GITHUB_ENV
115+
116+ - name : Install Package
70117 run : |
71- pytest tests -vv -rEPW -o pytest_collection_order=alphabetical --cache-clear --color=yes
118+ pip install ${{ env.PACKAGE_NAME }}
0 commit comments