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