Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,38 @@ jobs:
build_all_kmods: true
build_all_modules: true
build_full: true
upload_images: true
ccache_type: packages
upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }}
check_packages_list: ${{ needs.determine_changed_packages.outputs.changed_packages }}

test:
name: Test with QEMU
needs: build
strategy:
fail-fast: False
matrix:
include:
- target: malta
subtarget: be
image: openwrt-malta-be-vmlinux-initramfs.elf
use_qemu: true
qemu_target: mips
- target: x86
subtarget: 64
image: openwrt-x86-64-generic-squashfs-combined.img
use_qemu: true
qemu_target: x86
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add armsr/armv8 here, too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra 40 minutes for each run but yes

qemu_bin: x86_64
uses: ./.github/workflows/reusable_test-image.yml
with:
target: ${{ matrix.target }}
subtarget: ${{ matrix.subtarget }}
image: ${{ matrix.image }}
use_qemu: ${{ matrix.use_qemu }}
qemu_target: ${{ matrix.qemu_target }}
qemu_bin: ${{ matrix.qemu_bin || '' }}

upload-ccache-cache-in-s3:
if: github.event_name == 'push' && github.repository_owner == 'openwrt'
name: Upload ccache cache to s3
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/reusable_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ on:
type: boolean
upload_external_toolchain:
type: boolean
upload_images:
type: boolean
use_ccache_cache:
type: boolean
default: true
Expand Down Expand Up @@ -739,3 +741,12 @@ jobs:
name: ${{ inputs.target }}-${{ inputs.subtarget }}-external-toolchain
path: openwrt/bin/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ steps.get-toolchain-name.outputs.toolchain-name }}
retention-days: 1

- name: Upload compiled images
if: inputs.build_full == true && inputs.upload_images == true
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.target }}-${{ inputs.subtarget }}${{ inputs.testing == true && '-testing' || '' }}-images
path: |
openwrt/bin/targets/${{ inputs.target }}/${{ inputs.subtarget }}/openwrt-${{ inputs.target }}-${{ inputs.subtarget }}-*
retention-days: 1
70 changes: 70 additions & 0 deletions .github/workflows/reusable_test-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Test Image

on:
workflow_call:
inputs:
target:
required: true
type: string
subtarget:
required: true
type: string
testing:
type: boolean
image:
required: true
type: string
use_qemu:
type: boolean
qemu_target:
type: string
qemu_bin:
type: string

jobs:
test:
name: Test image ${{ inputs.target }}/${{ inputs.subtarget }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: aparcar/openwrt-tests

- name: Install dependencies
run: |
sudo apt install python3-pip

- name: Install QEMU dependency
if: inputs.use_qemu == true
run: |
sudo apt install qemu-system-${{ inputs.qemu_target }}

- name: Install test project dependencies
run: |
pip3 install poetry
poetry install

- name: Download compiled images from build job
uses: actions/download-artifact@v4
with:
name: ${{ inputs.target }}-${{ inputs.subtarget }}${{ inputs.testing == true && '-testing' || '' }}-images

- name: Extract image if needed
run: |
# gunzip return 2 for warning hence we need to reset
if [ -f "${{ inputs.image }}.gz" ]; then
gunzip -q ${{ inputs.image }}.gz || true
fi

- name: Run test with QEMU
if: inputs.use_qemu == true
run: |
export LG_QEMU_BIN=qemu-system-${{ inputs.qemu_bin || inputs.qemu_target }}

poetry run pytest \
--lg-env tests/qemu.yaml \
--target ${{ inputs.target }}-${{ inputs.subtarget }} \
--firmware "$(pwd)"/${{ inputs.image }}