Merge pull request #115 from fledge-iot/FOGL-10165 #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: π§ͺ Verify Package Dependencies | |
on: | |
push: | |
branches: ['*'] | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
jobs: | |
verify-dependencies: | |
name: π οΈ ${{ matrix.os }}-${{ matrix.arch }} | |
runs-on: ${{ matrix.runs_on }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
arch: x86_64 | |
runs_on: ubuntu-22.04 | |
codename: jammy | |
- os: ubuntu-22.04 | |
arch: aarch64 | |
runs_on: ubuntu-22.04 | |
codename: jammy | |
- os: ubuntu-24.04 | |
arch: x86_64 | |
runs_on: ubuntu-24.04 | |
codename: noble | |
- os: ubuntu-24.04 | |
arch: aarch64 | |
runs_on: ubuntu-24.04 | |
codename: noble | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Set up environment | |
run: | | |
echo "CONTROL_FILE=packages/Debian/${{ matrix.arch }}/DEBIAN/control" >> $GITHUB_ENV | |
echo "REPORT=dep_report_${{ matrix.os }}_${{ matrix.arch }}.md" >> $GITHUB_ENV | |
- name: Validate control file exists | |
run: | | |
if [ ! -f "$CONTROL_FILE" ]; then | |
echo "β Control file missing: $CONTROL_FILE" | |
echo "Available files in packages/Debian/:" | |
find packages/Debian/ -name "control" 2>/dev/null || echo "No control files found" | |
exit 1 | |
fi | |
echo "β Control file found: $CONTROL_FILE" | |
- name: Verify dependencies & generate report | |
env: | |
TARGET_OS: ${{ matrix.os }} | |
TARGET_ARCH: ${{ matrix.arch }} | |
TARGET_CODENAME: ${{ matrix.codename }} | |
run: | | |
# Run the dedicated dependency verification script with proper error handling | |
set -e # Exit on any error | |
echo "π Starting dependency verification..." | |
if ! ./scripts/verify-dependencies.sh \ | |
"$CONTROL_FILE" \ | |
"$REPORT" \ | |
"$TARGET_OS" \ | |
"$TARGET_ARCH" \ | |
"$TARGET_CODENAME"; then | |
echo "β Dependency verification script failed with exit code $?" | |
echo "::error::Dependency verification failed for $TARGET_ARCH on $TARGET_OS ($TARGET_CODENAME)" | |
exit 1 | |
fi | |
echo "β Dependency verification completed successfully" | |
- name: Validate report was generated | |
run: | | |
if [ ! -f "$REPORT" ] || [ ! -s "$REPORT" ]; then | |
echo "β Report file is missing or empty" | |
exit 1 | |
fi | |
echo "β Report generated successfully ($(wc -l < "$REPORT") lines)" | |
- name: Add summary to job | |
if: always() | |
run: | | |
echo "# π¦ Summary" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
if [ -f "$REPORT" ]; then | |
cat "$REPORT" >> $GITHUB_STEP_SUMMARY | |
else | |
echo "β Report generation failed" >> $GITHUB_STEP_SUMMARY | |
fi | |
- name: Check for failures | |
if: failure() | |
run: | | |
echo "β Dependency verification failed for ${{ matrix.os }} (${{ matrix.arch }})" | |
echo "This indicates build or runtime dependencies are missing." | |
echo "Please review the generated report and update the control file or repository configuration." | |
exit 1 |