You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.7 KiB

  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: arc_archs
  13. target: archs38-generic
  14. runtime_test: false
  15. - arch: arm_cortex-a9_vfpv3-d16
  16. target: mvebu-cortexa9
  17. runtime_test: false
  18. - arch: mips_24kc
  19. target: ath79-generic
  20. runtime_test: false
  21. - arch: powerpc_464fp
  22. target: apm821xx-nand
  23. runtime_test: false
  24. - arch: powerpc_8540
  25. target: mpc85xx-p1010
  26. runtime_test: false
  27. - arch: aarch64_cortex-a53
  28. target: mvebu-cortexa53
  29. runtime_test: true
  30. - arch: arm_cortex-a15_neon-vfpv4
  31. target: armvirt-32
  32. runtime_test: true
  33. - arch: i386_pentium-mmx
  34. target: x86-geode
  35. runtime_test: true
  36. - arch: x86_64
  37. target: x86-64
  38. runtime_test: true
  39. steps:
  40. - uses: actions/checkout@v2
  41. with:
  42. fetch-depth: 0
  43. - name: Determine branch name
  44. run: |
  45. BRANCH="${GITHUB_BASE_REF#refs/heads/}"
  46. echo "Building for $BRANCH"
  47. echo "BRANCH=$BRANCH" >> $GITHUB_ENV
  48. - name: Determine changed packages
  49. run: |
  50. # only detect packages with changes
  51. PKG_ROOTS=$(find . -name Makefile | \
  52. grep -v ".*/src/Makefile" | \
  53. sed -e 's@./\(.*\)/Makefile@\1/@')
  54. CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH)
  55. for ROOT in $PKG_ROOTS; do
  56. for CHANGE in $CHANGES; do
  57. if [[ "$CHANGE" == "$ROOT"* ]]; then
  58. PACKAGES+=$(echo "$ROOT" | sed -e 's@.*/\(.*\)/@\1 @')
  59. break
  60. fi
  61. done
  62. done
  63. # fallback to test packages if nothing explicitly changes this is
  64. # should run if other mechanics in packages.git changed
  65. PACKAGES="${PACKAGES:-vim attendedsysupgrade-common bmon}"
  66. echo "Building $PACKAGES"
  67. echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
  68. - name: Determine depended packages
  69. run: |
  70. DEPENDS=$(docker run --rm \
  71. "openwrt/imagebuilder:${{ matrix.target }}-$BRANCH" \
  72. make whatdepends PACKAGE="$PACKAGES" | grep $'\t' | \
  73. grep -v luci-i18n | awk '{ print $1 }' | tr '\n' ' ')
  74. echo "Building $DEPENDS"
  75. echo "PACKAGES=$PACKAGES $DEPENDS" >> $GITHUB_ENV
  76. - name: Build
  77. uses: openwrt/gh-action-sdk@v1
  78. env:
  79. ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
  80. FEEDNAME: packages_ci
  81. - name: Move created packages to project dir
  82. run: cp bin/packages/${{ matrix.arch }}/packages_ci/*.ipk . || true
  83. - name: Store packages
  84. uses: actions/upload-artifact@v2
  85. with:
  86. name: ${{ matrix.arch}}-packages
  87. path: "*.ipk"
  88. - name: Store logs
  89. uses: actions/upload-artifact@v2
  90. with:
  91. name: ${{ matrix.arch}}-logs
  92. path: logs/
  93. - name: Remove logs
  94. run: sudo rm -rf logs/ || true
  95. - name: Register QEMU
  96. if: ${{ matrix.runtime_test }}
  97. run: |
  98. sudo docker run --rm --privileged aptman/qus -s -- -p
  99. - name: Build Docker container
  100. if: ${{ matrix.runtime_test }}
  101. run: |
  102. docker build -t test-container --build-arg ARCH .github/workflows/
  103. env:
  104. ARCH: ${{ matrix.arch }}
  105. - name: Test via Docker container
  106. if: ${{ matrix.runtime_test }}
  107. run: |
  108. docker run --rm -v $GITHUB_WORKSPACE:/ci test-container