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