Merge pull request #14400 from FrederickGeek8/fix-14287
[feed/packages.git] / .github / workflows / multi-arch-test-build.yml
1 name: Test Build
2
3 on:
4 pull_request:
5
6 jobs:
7 build:
8 name: Test ${{ matrix.arch }}
9 runs-on: ubuntu-latest
10 strategy:
11 fail-fast: false
12 matrix:
13 arch:
14 - arc_archs
15 - arm_cortex-a9_vfpv3-d16
16 - mips_24kc
17 - powerpc_464fp
18 - powerpc_8540
19 runtime_test: [false]
20 include:
21 - arch: aarch64_cortex-a53
22 runtime_test: true
23 - arch: arm_cortex-a15_neon-vfpv4
24 runtime_test: true
25 - arch: i386_pentium-mmx
26 runtime_test: true
27 - arch: x86_64
28 runtime_test: true
29
30 steps:
31 - uses: actions/checkout@v2
32 with:
33 fetch-depth: 0
34
35 - name: Determine changed packages
36 run: |
37 # only detect packages with changed Makefiles
38 PACKAGES="$(git diff --diff-filter=d --name-only origin/master \
39 | grep -E 'Makefile$|test.sh$' | grep -Ev '/files/|/src/' \
40 | awk -F/ '{ print $(NF-1) }' | tr '\n' ' ')"
41
42 # fallback to test packages if nothing explicitly changes this is
43 # should run if other mechanics in packages.git changed
44 PACKAGES="${PACKAGES:-vim tmux bmon}"
45
46 echo "Building $PACKAGES"
47 echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
48
49 - name: Determine branch name
50 run: |
51 BRANCH="${GITHUB_BASE_REF#refs/heads/}"
52 echo "Building for $BRANCH"
53 echo "BRANCH=$BRANCH" >> $GITHUB_ENV
54
55 - name: Build
56 uses: openwrt/gh-action-sdk@v1
57 env:
58 ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
59 FEEDNAME: packages_ci
60
61 - name: Move created packages to project dir
62 run: cp bin/packages/${{ matrix.arch }}/packages_ci/*.ipk . || true
63
64 - name: Store packages
65 uses: actions/upload-artifact@v2
66 with:
67 name: ${{ matrix.arch}}-packages
68 path: "*.ipk"
69
70 - name: Store logs
71 uses: actions/upload-artifact@v2
72 with:
73 name: ${{ matrix.arch}}-logs
74 path: logs/
75
76 - name: Remove logs
77 run: sudo rm -rf logs/ || true
78
79 - name: Register QEMU
80 if: ${{ matrix.runtime_test }}
81 run: |
82 sudo docker run --rm --privileged aptman/qus -s -- -p
83
84 - name: Build Docker container
85 if: ${{ matrix.runtime_test }}
86 run: |
87 docker build -t test-container --build-arg ARCH .github/workflows/
88 env:
89 ARCH: ${{ matrix.arch }}
90
91 - name: Test via Docker container
92 if: ${{ matrix.runtime_test }}
93 run: |
94 docker run --rm -v $GITHUB_WORKSPACE:/ci test-container