Use build matrix
This commit is contained in:
@@ -33,10 +33,14 @@ jobs:
|
|||||||
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"
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
build-heltec-v3:
|
build:
|
||||||
name: Build heltec_v3
|
name: Build firmware
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ verify ]
|
needs: [ verify ]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
board: [ heltec_v3, seeed_xiao_s3_wio_sx1262 ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -52,98 +56,39 @@ jobs:
|
|||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.platformio
|
path: ~/.platformio
|
||||||
key: ${{ runner.os }}-platformio-heltec-v3-${{ hashFiles('**/platformio.ini') }}
|
key: ${{ runner.os }}-platformio-${{ matrix.board }}-${{ hashFiles('**/platformio.ini') }}
|
||||||
|
|
||||||
- name: Build heltec_v3
|
- name: Build firmware
|
||||||
run: pio run -e heltec_v3
|
run: pio run -e ${{ matrix.board }}
|
||||||
|
|
||||||
- name: Upload firmware artifact
|
- name: Upload firmware to Gitea (direct)
|
||||||
uses: actions/upload-artifact@v4
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
with:
|
env:
|
||||||
name: firmware-heltec_v3
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
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: |
|
run: |
|
||||||
TIMESTAMP=$(date +%s)
|
TIMESTAMP=$(date +%s)
|
||||||
|
mkdir -p artifacts
|
||||||
|
cp .pio/build/${{ matrix.board }}/firmware.bin artifacts/firmware-${{ matrix.board }}.bin
|
||||||
|
filename=firmware-${{ matrix.board }}-${TIMESTAMP}.bin
|
||||||
|
echo "Uploading $filename..."
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
-F "file=@artifacts/firmware-${{ matrix.board }}.bin" \
|
||||||
|
"${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/generic/firmware/${{ github.ref_name }}/${filename}"
|
||||||
|
|
||||||
# Create package directory
|
# Note: artifact upload via actions/upload-artifact didn't work on this Gitea instance.
|
||||||
mkdir -p packages
|
# Each matrix build uploads directly to the Gitea generic package registry.
|
||||||
|
|
||||||
# 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:
|
summary:
|
||||||
name: Build Summary
|
name: Build Summary
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ verify, build-heltec-v3, build-seeed-xiao, publish-packages ]
|
needs: [ verify, build ]
|
||||||
if: always()
|
if: always()
|
||||||
steps:
|
steps:
|
||||||
- name: Check status
|
- name: Check status
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ needs.verify.result }}" = "failure" ] || [ "${{ needs.build-heltec-v3.result }}" = "failure" ] || [ "${{ needs.build-seeed-xiao.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
|
||||||
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"
|
echo "✅ All checks passed"
|
||||||
|
|||||||
Reference in New Issue
Block a user