Skip to content

Add workflow with DTS tests #14

Add workflow with DTS tests

Add workflow with DTS tests #14

Workflow file for this run

---
name: Run DTS tests
on:
pull_request:
# branches:
# - 'main'
jobs:
build-dts:
uses: ./.github/workflows/build.yml
run-tests:
name: Run DTS tests
if: ${{ contains(join(needs.*.result, ','), 'success') }}
needs: build-dts
runs-on:
labels: dts-builder
outputs:
qemu_pid: ${{ steps.run_qemu.outputs.qemu_pid }}
steps:
- name: Checkout OSFV repo
uses: actions/checkout@v4
with:
repository: 'Dasharo/open-source-firmware-validation'
path: 'open-source-firmware-validation'
submodules: 'recursive'
ref: 'develop'
- name: Copy DTS binary
shell: bash
run: |
mkdir open-source-firmware-validation/scripts/ci/qemu-data
bmaptool copy \
--bmap build/tmp/deploy/images/genericx86-64/dts-base-image-genericx86-64.wic.bmap \
build/tmp/deploy/images/genericx86-64/dts-base-image-genericx86-64.wic.gz \
open-source-firmware-validation/scripts/ci/qemu-data/dts.img
- name: Install requirements
shell: bash
run: |
cd open-source-firmware-validation
python3 -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
- name: Run QEMU
shell: bash
id: run_qemu
run: |
cd open-source-firmware-validation/scripts/ci
qemu-img create -f qcow2 qemu-data/hdd.qcow2 20G
HDD_PATH=qemu-data/dts.img ./qemu-run.sh nographic os &
pid=$!
echo "qemu_pid=$pid" >> "$GITHUB_OUTPUT"
- name: Create directory for logs
shell: bash
id: log_dirs
run: |
timestamp=$(date -u +%Y-%m-%dT%H:%M:%S%Z)
directory="/tmp/dts-test-ci-${timestamp}"
mkdir $directory
echo "directory=$directory" >> "$GITHUB_OUTPUT"
# TODO: Add DPP keys to secrets and use them in tests
- name: Run tests
shell: bash
env:
DPP_EMAIL: ${{ secrets.DPP_EMAIL }}
DPP_PASSWORD: ${{ secrets.DPP_PASSWORD }}
LOG_DIR: ${{ steps.log_dirs.outputs.directory }}
run: |
source venv/bin/activate
robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -v snipeit:no \
dts/dts-e2e.robot 2>&1 | tee $LOG_DIR/output.log | grep "| PASS |\|| FAIL |"
- name: Copy log
shell: bash
env:
LOG_DIR: ${{ steps.log_dirs.outputs.directory }}
run: |
cp log.html $LOG_DIR/log.html
cleanup:
name: Cleanup
if: always()
needs: run-tests
runs-on:
labels: dts-builder
steps:
- name: Cleanup after tests
shell: bash
run: |
qemu_pid="${{ needs.run-tests.outputs.qemu_pid }}"
if [ ! -z "$qemu_pid" ]; then
kill $qemu_pid
fi
cd ..
rm -rf open-source-firmware-validation meta-dts build