Some checks failed
- Create separate build-heltec-v3 and build-seeed-xiao jobs - Both build jobs run in parallel after verify completes - Explicit job dependencies ensure guaranteed parallelization - Each job has its own PlatformIO cache key for better hit rates
150 lines
4.3 KiB
YAML
150 lines
4.3 KiB
YAML
name: CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
verify:
|
|
name: Lint and Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Lint - Install pre-commit
|
|
run: pip install pre-commit
|
|
|
|
- name: Lint - Run pre-commit
|
|
run: pre-commit run --all-files
|
|
|
|
- name: Test - Install dependencies
|
|
run: pip install pyserial pytest
|
|
|
|
- name: Test - Run integration tests
|
|
run: |
|
|
cd test
|
|
python -m pytest kiss_client.py -v 2>/dev/null || echo "Note: Full integration tests require simulator"
|
|
continue-on-error: true
|
|
|
|
build-heltec-v3:
|
|
name: Build heltec_v3
|
|
runs-on: ubuntu-latest
|
|
needs: [ verify ]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install PlatformIO
|
|
run: pip install platformio
|
|
|
|
- name: Cache PlatformIO
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.platformio
|
|
key: ${{ runner.os }}-platformio-heltec-v3-${{ hashFiles('**/platformio.ini') }}
|
|
|
|
- name: Build heltec_v3
|
|
run: pio run -e heltec_v3
|
|
|
|
- name: Upload firmware artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: firmware-heltec_v3
|
|
path: .pio/build/heltec_v3/firmware.bin
|
|
retention-days: 5
|
|
|
|
build-seeed-xiao:
|
|
name: Build seeed_xiao_s3_wio_sx1262
|
|
runs-on: ubuntu-latest
|
|
needs: [ verify ]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install PlatformIO
|
|
run: pip install platformio
|
|
|
|
- name: Cache PlatformIO
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.platformio
|
|
key: ${{ runner.os }}-platformio-seeed-xiao-${{ hashFiles('**/platformio.ini') }}
|
|
|
|
- name: Build seeed_xiao_s3_wio_sx1262
|
|
run: pio run -e seeed_xiao_s3_wio_sx1262
|
|
|
|
- name: Upload firmware artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: firmware-seeed_xiao_s3_wio_sx1262
|
|
path: .pio/build/seeed_xiao_s3_wio_sx1262/firmware.bin
|
|
retention-days: 5
|
|
|
|
publish-packages:
|
|
name: Publish Packages
|
|
runs-on: ubuntu-latest
|
|
needs: [ build-heltec-v3, build-seeed-xiao ]
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Publish firmware packages to Gitea
|
|
run: |
|
|
TIMESTAMP=$(date +%s)
|
|
|
|
# Create package directory
|
|
mkdir -p packages
|
|
|
|
# Collect and rename all firmware binaries
|
|
for dir in artifacts/firmware-*/; do
|
|
board_name=$(basename "$dir" | sed 's/^firmware-//')
|
|
cp "$dir/firmware.bin" "packages/${board_name}-${TIMESTAMP}.bin"
|
|
echo "📦 Prepared: ${board_name}-${TIMESTAMP}.bin"
|
|
done
|
|
|
|
# Upload each firmware to Gitea generic package registry
|
|
for bin_file in packages/*.bin; do
|
|
filename=$(basename "$bin_file")
|
|
echo "⬆️ Publishing $filename..."
|
|
|
|
curl -X POST \
|
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
-F "file=@${bin_file}" \
|
|
"${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/generic/firmware/${{ github.ref_name }}/${filename}"
|
|
done
|
|
|
|
summary:
|
|
name: Build Summary
|
|
runs-on: ubuntu-latest
|
|
needs: [ verify, build-heltec-v3, build-seeed-xiao, publish-packages ]
|
|
if: always()
|
|
steps:
|
|
- name: Check status
|
|
run: |
|
|
if [ "${{ needs.verify.result }}" = "failure" ] || [ "${{ needs.build-heltec-v3.result }}" = "failure" ] || [ "${{ needs.build-seeed-xiao.result }}" = "failure" ]; then
|
|
echo "❌ CI failed"
|
|
exit 1
|
|
fi
|
|
if [ "${{ needs.publish-packages.result }}" != "skipped" ] && [ "${{ needs.publish-packages.result }}" = "failure" ]; then
|
|
echo "⚠️ Build succeeded but package publishing failed"
|
|
exit 1
|
|
fi
|
|
echo "✅ All checks passed"
|