| 1 |
name: CI |
| 2 |
|
| 3 |
on: [push] |
| 4 |
|
| 5 |
jobs: |
| 6 |
lint: |
| 7 |
runs-on: ubuntu-latest |
| 8 |
strategy: |
| 9 |
matrix: |
| 10 |
python-version: ["3.8", "3.9", "3.10"] |
| 11 |
steps: |
| 12 |
- uses: actions/checkout@v3 |
| 13 |
- name: Set up Python ${{ matrix.python-version }} |
| 14 |
uses: actions/setup-python@v3 |
| 15 |
with: |
| 16 |
python-version: ${{ matrix.python-version }} |
| 17 |
- name: Install dependencies |
| 18 |
run: | |
| 19 |
python -m pip install --upgrade black |
| 20 |
- name: black format check |
| 21 |
run: black --check --line-length 120 traffic_light/ test/ setup.py |
| 22 |
|
| 23 |
test: |
| 24 |
strategy: |
| 25 |
fail-fast: false |
| 26 |
max-parallel: 6 |
| 27 |
matrix: |
| 28 |
python-version: [3.8, 3.9, "3.10"] |
| 29 |
os: [ubuntu-latest] |
| 30 |
include: |
| 31 |
- os: ubuntu-latest |
| 32 |
|
| 33 |
runs-on: ${{ matrix.os }} |
| 34 |
steps: |
| 35 |
- uses: actions/checkout@v3 |
| 36 |
- name: Set up Python ${{ matrix.python-version }} |
| 37 |
uses: actions/setup-python@v4 |
| 38 |
with: |
| 39 |
python-version: ${{ matrix.python-version }} |
| 40 |
- name: Setup build and test environment |
| 41 |
run: | |
| 42 |
python -m pip install --upgrade pip |
| 43 |
- name: Build Python Package |
| 44 |
run: | |
| 45 |
python -m pip install -r requirements-dev.txt |
| 46 |
- name: Update pytest on >= Python3.10 |
| 47 |
if: ${{ matrix.python-version == '3.10' || matrix.python-version == '3.11' }} |
| 48 |
run: | |
| 49 |
python -m pip install pytest==7.0.1 |
| 50 |
- name: Unit Test with pytest |
| 51 |
run: PYTHONPATH=. pytest test --cov=traffic_light --cov-report term-missing |