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.

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