build.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. name: Test Build
  2. on:
  3. pull_request:
  4. jobs:
  5. build:
  6. name: Test ${{ matrix.arch }}
  7. runs-on: ubuntu-latest
  8. strategy:
  9. fail-fast: false
  10. matrix:
  11. include:
  12. - arch: x86_64
  13. target: x86-64
  14. steps:
  15. - uses: actions/checkout@v4
  16. with:
  17. fetch-depth: 0
  18. - name: Determine branch name
  19. run: |
  20. BRANCH="${GITHUB_BASE_REF#refs/heads/}"
  21. echo "Building for $BRANCH"
  22. echo "BRANCH=$BRANCH" >> $GITHUB_ENV
  23. - name: Determine changed packages
  24. run: |
  25. # only detect packages with changes
  26. PKG_ROOTS=$(find . -name Makefile | \
  27. grep -v ".*/src/Makefile" | \
  28. sed -e 's@./\(.*\)/Makefile@\1/@')
  29. CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH)
  30. for ROOT in $PKG_ROOTS; do
  31. for CHANGE in $CHANGES; do
  32. if [[ "$CHANGE" == "$ROOT"* ]]; then
  33. PACKAGES+=$(echo "$ROOT" | sed -e 's@.*/\(.*\)/@\1 @')
  34. break
  35. fi
  36. done
  37. done
  38. # fallback to test packages if nothing explicitly changes this is
  39. # should run if other mechanics in packages.git changed
  40. PACKAGES="${PACKAGES:-luci-app-attendedsysupgrade}"
  41. echo "Building $PACKAGES"
  42. echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
  43. - name: Build
  44. uses: openwrt/gh-action-sdk@v5
  45. env:
  46. ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
  47. FEEDNAME: packages_ci
  48. - name: Move created packages to project dir
  49. run: cp bin/packages/${{ matrix.arch }}/packages_ci/*.ipk . || true
  50. - name: Store packages
  51. uses: actions/upload-artifact@v4
  52. with:
  53. name: ${{ matrix.arch}}-packages
  54. path: "*.ipk"
  55. - name: Store logs
  56. uses: actions/upload-artifact@v4
  57. with:
  58. name: ${{ matrix.arch}}-logs
  59. path: logs/