CI: Add local feed for CI-built packages
[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: Generate build keys
82 run: |
83 sudo apt-get install -y signify-openbsd
84 signify-openbsd -G -n -c 'DO NOT USE - OpenWrt packages feed CI' -p packages_ci.pub -s packages_ci.sec
85 EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
86 echo "KEY_BUILD<<$EOF" >> $GITHUB_ENV
87 cat packages_ci.sec >> $GITHUB_ENV
88 echo "$EOF" >> $GITHUB_ENV
89
90 - name: Build
91 uses: openwrt/gh-action-sdk@v5
92 env:
93 ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
94 FEEDNAME: packages_ci
95 INDEX: 1
96 KEY_BUILD: ${{ env.KEY_BUILD }}
97
98 - name: Move created packages to project dir
99 run: cp bin/packages/${{ matrix.arch }}/packages_ci/* . || true
100
101 - name: Store packages
102 uses: actions/upload-artifact@v3
103 with:
104 name: ${{env.ARCHIVE_NAME}}-packages
105 path: |
106 Packages
107 Packages.*
108 *.ipk
109 PKG-INFO
110
111 - name: Store logs
112 uses: actions/upload-artifact@v3
113 with:
114 name: ${{ matrix.arch}}-logs
115 path: logs/
116
117 - name: Remove logs
118 run: sudo rm -rf logs/ || true
119
120 - name: Register QEMU
121 if: ${{ matrix.runtime_test }}
122 run: |
123 sudo docker run --rm --privileged aptman/qus -s -- -p
124
125 - name: Build Docker container
126 if: ${{ matrix.runtime_test }}
127 run: |
128 docker build -t test-container --build-arg ARCH .github/workflows/
129 env:
130 ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
131
132 - name: Test via Docker container
133 if: ${{ matrix.runtime_test }}
134 run: |
135 docker run --rm -v $GITHUB_WORKSPACE:/ci test-container