[PATCH 17/17] [RFC] test: run ./test/emulate.pl in Github action

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Apr 12 08:16:51 BST 2021


See https://github.com/a3f/barebox/actions for an example how this could
look like.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 .github/workflows/build-configs.yaml | 41 ++++++++++++++++
 .github/workflows/vm-tests.yaml      | 71 ++++++++++++++++++++++++++++
 .gitignore                           |  2 +
 test/kconfig/no-deps.cfg             |  3 ++
 4 files changed, 117 insertions(+)
 create mode 100644 .github/workflows/build-configs.yaml
 create mode 100644 .github/workflows/vm-tests.yaml
 create mode 100644 test/kconfig/no-deps.cfg

diff --git a/.github/workflows/build-configs.yaml b/.github/workflows/build-configs.yaml
new file mode 100644
index 000000000000..5025c2e04017
--- /dev/null
+++ b/.github/workflows/build-configs.yaml
@@ -0,0 +1,41 @@
+name: Build Configs
+on:
+  push:
+
+jobs:
+  build:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os: ['ubuntu-latest' ]
+        ARCH: [ 'arm', 'mips', 'riscv' ]
+    name: ARCH=${{ matrix.ARCH }} Build
+    steps:
+    - name: Checkout code
+      uses: actions/checkout at v2
+
+    - name: Setup Environment
+      run: |
+        sudo apt-get update -qq
+        sudo apt-get install -y --no-install-recommends libyaml-tiny-perl \
+            lzop libusb-1.0-0-dev
+        pip3 install tuxmake
+
+    - name: Build Configs
+      run: |
+        for cfg in arch/${{ matrix.ARCH }}/configs/*_defconfig; do
+            cfg=$(basename $cfg)
+            DESTDIR="./artifacts/${{ matrix.ARCH }}-$cfg"
+            mkdir -p $DESTDIR
+            tuxmake -a "${{ matrix.ARCH }}" -k $cfg --runtime=podman -o $DESTDIR default \
+                    --kconfig-add test/kconfig/no-deps.cfg
+        done
+
+    - name: Publish Build Artifacts
+      uses: actions/upload-artifact at v2
+      if: always()
+      with:
+        name: Build Logs
+        path: artifacts/
+        if-no-files-found: error
diff --git a/.github/workflows/vm-tests.yaml b/.github/workflows/vm-tests.yaml
new file mode 100644
index 000000000000..ac74dec5789b
--- /dev/null
+++ b/.github/workflows/vm-tests.yaml
@@ -0,0 +1,71 @@
+name: VM Tests
+on:
+  push:
+
+jobs:
+  build:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os: ['ubuntu-latest' ]
+        ARCH: [ 'arm', 'mips', 'x86', 'riscv', 'openrisc' ]
+    name: ARCH=${{ matrix.ARCH }} Test
+    steps:
+    - name: Checkout code
+      uses: actions/checkout at v2
+
+    - name: Setup Environment
+      run: |
+        sudo apt-get update -qq
+        sudo apt-get install -y --no-install-recommends libyaml-tiny-perl \
+            qemu-system-arm qemu-system-mips qemu-system-x86 qemu-system-common qemu-system-misc
+        curl --remote-name --location \
+            http://ftp.us.debian.org/debian/pool/main/e/edk2/ovmf_2020.11-4_all.deb
+        sudo dpkg -i ovmf_2020.11-4_all.deb
+        pushd /tmp
+        git clone --depth 1 https://github.com/labgrid-project/labgrid
+        pushd labgrid
+        pip3 install -r requirements.txt
+        sudo python3 setup.py install
+        sudo ln -s $(which pytest) /usr/local/bin/labgrid-pytest
+        #pip3 install tuxmake
+        popd
+        git clone --depth 1 https://gitlab.com/a3f/tuxmake
+        cd tuxmake
+        python3 -m pip install flit
+        flit install
+        popd
+        sudo apt install lzop
+        if [ "${{ matrix.ARCH }}" = "openrisc" ]; then
+            curl --remote-name --location \
+                https://github.com/stffrdhrn/gcc/releases/download/or1k-10.0.0-20190723/or1k-linux-10.0.0-20190723.tar.xz
+            pushd /usr/local
+            sudo tar -xf $OLDPWD/or1k-linux-10.0.0-20190723.tar.xz --strip 1
+            popd
+            sudo ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
+        fi
+
+    - name: Build and Run Tests
+      run: |
+        NAME=${{ matrix.ARCH }}-{config}
+        OPTS="--kconfig-full --test -- --junitxml=$PWD/$NAME.tests.xml --lg-log=$PWD/log/$NAME"
+        if [ "${{ matrix.ARCH }}" != "openrisc" ]; then
+            OPTS="--runtime=podman $OPTS"
+        fi
+
+        ARCH=${{ matrix.ARCH }} ./test/emulate.pl $OPTS
+
+    - name: Publish Test Results
+      uses: EnricoMi/publish-unit-test-result-action at v1.11
+      if: always()
+      with:
+        files: ./*.tests.xml
+
+    - name: Publish Labgrid Log Results
+      uses: actions/upload-artifact at v2
+      if: always()
+      with:
+        name: Console Logs
+        path: log/
+        if-no-files-found: error
diff --git a/.gitignore b/.gitignore
index d7a37b3c9b39..ee67c725ba34 100644
--- a/.gitignore
+++ b/.gitignore
@@ -88,3 +88,5 @@ GTAGS
 /allrandom.config
 /allyes.config
 /compile_commands.json
+
+!.github/
diff --git a/test/kconfig/no-deps.cfg b/test/kconfig/no-deps.cfg
new file mode 100644
index 000000000000..98ffd398decc
--- /dev/null
+++ b/test/kconfig/no-deps.cfg
@@ -0,0 +1,3 @@
+# CONFIG_ARCH_IMX_USBLOADER is not set
+# CONFIG_OMAP3_USB_LOADER is not set
+# CONFIG_OMAP4_HOSTTOOL_USBBOOT is not set
-- 
2.29.2




More information about the barebox mailing list