Restructure CI pipeline for proper sequencing and parallelization
- Merge lint and test into single 'verify' job for guaranteed sequential execution - Build job runs in parallel for each target, but waits for verify to complete - Ensures order: verify (lint → test) → build (parallel) → publish-packages - Fixes Gitea Actions job dependency handling
This commit is contained in:
@@ -7,8 +7,8 @@ on:
|
|||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
verify:
|
||||||
name: Lint and Format Check
|
name: Lint and Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -18,29 +18,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Install pre-commit
|
- name: Lint - Install pre-commit
|
||||||
run: pip install pre-commit
|
run: pip install pre-commit
|
||||||
|
|
||||||
- name: Run pre-commit
|
- name: Lint - Run pre-commit
|
||||||
run: pre-commit run --all-files
|
run: pre-commit run --all-files
|
||||||
|
|
||||||
test:
|
- name: Test - Install dependencies
|
||||||
name: Unit Tests
|
run: pip install pyserial pytest
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [ lint ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Test - Run integration tests
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
pip install pyserial pytest
|
|
||||||
|
|
||||||
- name: Run integration tests (client validation)
|
|
||||||
run: |
|
run: |
|
||||||
cd test
|
cd test
|
||||||
python -m pytest kiss_client.py -v 2>/dev/null || echo "Note: Full integration tests require simulator"
|
python -m pytest kiss_client.py -v 2>/dev/null || echo "Note: Full integration tests require simulator"
|
||||||
@@ -49,7 +36,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build ${{ matrix.target }}
|
name: Build ${{ matrix.target }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ test ]
|
needs: [ verify ]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -65,15 +52,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install PlatformIO
|
||||||
|
run: pip install platformio
|
||||||
|
|
||||||
- name: Cache PlatformIO
|
- name: Cache PlatformIO
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.platformio
|
path: ~/.platformio
|
||||||
key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }}
|
key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }}
|
||||||
|
|
||||||
- name: Install PlatformIO
|
|
||||||
run: pip install platformio
|
|
||||||
|
|
||||||
- name: Build ${{ matrix.target }}
|
- name: Build ${{ matrix.target }}
|
||||||
run: pio run -e ${{ matrix.target }}
|
run: pio run -e ${{ matrix.target }}
|
||||||
|
|
||||||
@@ -122,12 +109,12 @@ jobs:
|
|||||||
summary:
|
summary:
|
||||||
name: Build Summary
|
name: Build Summary
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ lint, test, build, publish-packages ]
|
needs: [ verify, build, publish-packages ]
|
||||||
if: always()
|
if: always()
|
||||||
steps:
|
steps:
|
||||||
- name: Check status
|
- name: Check status
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ needs.lint.result }}" = "failure" ] || [ "${{ needs.test.result }}" = "failure" ] || [ "${{ needs.build.result }}" = "failure" ]; then
|
if [ "${{ needs.verify.result }}" = "failure" ] || [ "${{ needs.build.result }}" = "failure" ]; then
|
||||||
echo "❌ CI failed"
|
echo "❌ CI failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user