7 group: ${{ github.workflow }}-${{ github.ref }}
8 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
12 name: Test ${{ matrix.arch }}
13 runs-on: ubuntu-latest
18 - arch: arm_cortex-a9_vfpv3-d16
19 target: mvebu-cortexa9
34 - arch: aarch64_cortex-a53
35 target: mvebu-cortexa53
38 - arch: arm_cortex-a15_neon-vfpv4
42 - arch: i386_pentium-mmx
51 - uses: actions/checkout@v3
55 - name: Determine branch name
57 BRANCH="${GITHUB_BASE_REF#refs/heads/}"
58 echo "Building for $BRANCH"
59 echo "BRANCH=$BRANCH" >> $GITHUB_ENV
61 - name: Determine changed packages
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)
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 @')
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}"
82 echo "Building $PACKAGES"
83 echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
85 - name: Generate build keys
88 sudo apt-get install -y signify-openbsd
89 signify-openbsd -G -n -c 'DO NOT USE - OpenWrt packages feed CI' -p packages_ci.pub -s packages_ci.sec
90 EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
91 echo "KEY_BUILD<<$EOF" >> $GITHUB_ENV
92 cat packages_ci.sec >> $GITHUB_ENV
93 echo "$EOF" >> $GITHUB_ENV
96 uses: openwrt/gh-action-sdk@v5
98 ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
101 KEY_BUILD: ${{ env.KEY_BUILD }}
103 - name: Move created packages to project dir
104 run: cp bin/packages/${{ matrix.arch }}/packages_ci/* . || true
106 - name: Store packages
107 uses: actions/upload-artifact@v3
109 name: ${{env.ARCHIVE_NAME}}-packages
117 uses: actions/upload-artifact@v3
119 name: ${{ matrix.arch}}-logs
123 run: sudo rm -rf logs/ || true
125 - name: Check if any packages were built
127 if [ -n "$(find . -maxdepth 1 -type f -name '*.ipk' -print -quit)" ]; then
128 echo "Found *.ipk files"
131 echo "No *.ipk files found"
134 echo "HAVE_IPKS=$HAVE_IPKS" >> $GITHUB_ENV
136 - name: Register QEMU
137 if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
140 sudo apt-get install -y qemu-user-static binfmt-support
141 sudo update-binfmts --import
143 - name: Build Docker container
144 if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
146 docker build -t test-container --build-arg ARCH .github/workflows/
148 ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
150 - name: Test via Docker container
151 if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
153 docker run --rm -v $GITHUB_WORKSPACE:/ci test-container