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: aarch64_generic
22 - arch: arm_cortex-a15_neon-vfpv4
26 - arch: arm_cortex-a9_vfpv3-d16
27 target: mvebu-cortexa9
30 - arch: i386_pentium-mmx
46 - arch: riscv64_riscv64
47 target: sifiveu-generic
55 - uses: actions/checkout@v3
59 - name: Determine branch name
61 BRANCH="${GITHUB_BASE_REF#refs/heads/}"
62 echo "Building for $BRANCH"
63 echo "BRANCH=$BRANCH" >> $GITHUB_ENV
65 - name: Determine changed packages
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)
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 @')
82 # fallback to test packages if nothing explicitly changes this is
83 # should run if other mechanics in packages.git changed
84 PACKAGES="${PACKAGES:-bird2 cjdns olsrd}"
86 echo "Building $PACKAGES"
87 echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
89 - name: Generate build keys
92 sudo apt-get install -y signify-openbsd
93 signify-openbsd -G -n -c 'DO NOT USE - OpenWrt packages feed CI' -p packages_ci.pub -s packages_ci.sec
94 EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
95 echo "KEY_BUILD<<$EOF" >> $GITHUB_ENV
96 cat packages_ci.sec >> $GITHUB_ENV
97 echo "$EOF" >> $GITHUB_ENV
100 uses: openwrt/gh-action-sdk@v5
102 ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
103 FEEDNAME: packages_ci
105 KEY_BUILD: ${{ env.KEY_BUILD }}
107 - name: Move created packages to project dir
108 run: cp bin/packages/${{ matrix.arch }}/packages_ci/* . || true
110 - name: Store packages
111 uses: actions/upload-artifact@v3
113 name: ${{env.ARCHIVE_NAME}}-packages
121 uses: actions/upload-artifact@v3
123 name: ${{ matrix.arch}}-logs
127 run: sudo rm -rf logs/ || true
129 - name: Check if any packages were built
131 if [ -n "$(find . -maxdepth 1 -type f -name '*.ipk' -print -quit)" ]; then
132 echo "Found *.ipk files"
135 echo "No *.ipk files found"
138 echo "HAVE_IPKS=$HAVE_IPKS" >> $GITHUB_ENV
140 - name: Register QEMU
141 if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
144 sudo apt-get install -y qemu-user-static binfmt-support
145 sudo update-binfmts --import
147 - name: Build Docker container
148 if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
150 docker build -t test-container --build-arg ARCH .github/workflows/
152 ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
154 - name: Test via Docker container
155 if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
157 docker run --rm -v $GITHUB_WORKSPACE:/ci test-container