CI: fix handling of release branches
[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 branch name
36 run: |
37 BRANCH="${GITHUB_BASE_REF#refs/heads/}"
38 echo "Building for $BRANCH"
39 echo "BRANCH=$BRANCH" >> $GITHUB_ENV
40
41 - name: Determine changed packages
42 run: |
43 # only detect packages with changes
44 PKG_ROOTS=$(find . -name Makefile | grep -v ".*/src/Makefile" | sed -e 's@./\(.*\)/Makefile@\1/@')
45 CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH)
46
47 for ROOT in $PKG_ROOTS; do
48 for CHANGE in $CHANGES; do
49 if [[ "$CHANGE" == "$ROOT"* ]]; then
50 PACKAGES+=$(echo "$ROOT" | sed -e 's@.*/\(.*\)/@\1 @')
51 break
52 fi
53 done
54 done
55
56 # fallback to test packages if nothing explicitly changes this is
57 # should run if other mechanics in packages.git changed
58 PACKAGES="${PACKAGES:-vim tmux bmon}"
59
60 echo "Building $PACKAGES"
61 echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
62
63 - name: Build
64 uses: openwrt/gh-action-sdk@v1
65 env:
66 ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
67 FEEDNAME: packages_ci
68
69 - name: Move created packages to project dir
70 run: cp bin/packages/${{ matrix.arch }}/packages_ci/*.ipk . || true
71
72 - name: Store packages
73 uses: actions/upload-artifact@v2
74 with:
75 name: ${{ matrix.arch}}-packages
76 path: "*.ipk"
77
78 - name: Store logs
79 uses: actions/upload-artifact@v2
80 with:
81 name: ${{ matrix.arch}}-logs
82 path: logs/
83
84 - name: Remove logs
85 run: sudo rm -rf logs/ || true
86
87 - name: Register QEMU
88 if: ${{ matrix.runtime_test }}
89 run: |
90 sudo docker run --rm --privileged aptman/qus -s -- -p
91
92 - name: Build Docker container
93 if: ${{ matrix.runtime_test }}
94 run: |
95 docker build -t test-container --build-arg ARCH .github/workflows/
96 env:
97 ARCH: ${{ matrix.arch }}
98
99 - name: Test via Docker container
100 if: ${{ matrix.runtime_test }}
101 run: |
102 docker run --rm -v $GITHUB_WORKSPACE:/ci test-container