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