CI: Do package run-tests only if target packages were built
Currently, the package run-test phase will fail for PRs that only
add/update host-only packages, as no target packages (*.ipk) are built.
This checks if any target packages are built before attempting the
run-tests.
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
(cherry picked from commit 5ce254fd8e
)
This commit is contained in:
parent
5b9bcdafb5
commit
9a7637358e
|
@ -164,19 +164,30 @@ jobs:
|
|||
- name: Remove logs
|
||||
run: sudo rm -rf logs/ || true
|
||||
|
||||
- name: Check if any packages were built
|
||||
run: |
|
||||
if [ -n "$(find . -maxdepth 1 -type f -name '*.ipk' -print -quit)" ]; then
|
||||
echo "Found *.ipk files"
|
||||
HAVE_IPKS=true
|
||||
else
|
||||
echo "No *.ipk files found"
|
||||
HAVE_IPKS=false
|
||||
fi
|
||||
echo "HAVE_IPKS=$HAVE_IPKS" >> $GITHUB_ENV
|
||||
|
||||
- name: Register QEMU
|
||||
if: ${{ matrix.runtime_test }}
|
||||
if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
|
||||
run: |
|
||||
sudo docker run --rm --privileged aptman/qus -s -- -p
|
||||
|
||||
- name: Build Docker container
|
||||
if: ${{ matrix.runtime_test }}
|
||||
if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
|
||||
run: |
|
||||
docker build --platform linux/${{ matrix.arch }} -t test-container --build-arg ARCH .github/workflows/
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
|
||||
|
||||
- name: Test via Docker container
|
||||
if: ${{ matrix.runtime_test }}
|
||||
if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
|
||||
run: |
|
||||
docker run --platform linux/${{ matrix.arch }} --rm -v $GITHUB_WORKSPACE:/ci test-container
|
||||
|
|
Loading…
Reference in New Issue