Files
meta-dts/.github/workflows/test.yml
2025-09-09 10:17:15 +02:00

151 lines
4.6 KiB
YAML

---
name: Run DTS tests
on:
pull_request:
branches:
- "main"
concurrency:
group: run-only-one-workflow
jobs:
build-uefi-sb:
uses: ./.github/workflows/build.yml
with:
cacheless: false
kas-path: meta-dts/kas-uefi-sb.yml
remove-build:
needs: build-uefi-sb
runs-on:
labels: dts-builder
steps:
- name: Remove build directory after UEFI SB build
run: |
rm -rf build
build-dts:
uses: ./.github/workflows/build.yml
needs: remove-build
with:
cacheless: false
kas-path: meta-dts/kas.yml
checkout-osfv:
runs-on: dts-builder
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"
run-tests:
name: Run DTS tests
needs: [checkout-osfv, build-dts]
runs-on:
labels: dts-builder
steps:
- name: Run IPXE server
shell: bash
run: |
./open-source-firmware-validation/scripts/ci/ipxe-run.sh \
build/tmp/deploy/images/genericx86-64/dts-base-image-genericx86-64.cpio.gz \
build/tmp/deploy/images/genericx86-64/bzImage &
- name: Install requirements
shell: bash
run: |
cd open-source-firmware-validation
if [ ! -d "venv" ]; then
python3.13 -m venv venv
fi
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
mkdir -p qemu-data
touch qemu-data/hdd.qcow2
./qemu-run.sh nographic os --no-audio-emulation &
for _ in {1..60}; do
sleep 1
if [ -f /tmp/qemu-pid ]; then
exit 0
fi
done
exit 1
- name: Create directory for logs
shell: bash
id: create_log_dirs
run: |
LOG_DIR="/tmp/dts-test-ci-${{ github.run_id }}"
mkdir -p $LOG_DIR
echo "LOG_DIR=$LOG_DIR" >> $GITHUB_ENV
- name: Run tests
shell: bash
run: |
cd open-source-firmware-validation
source venv/bin/activate
# This file is already present on dts-builder.
# It contains credentials for DPP subscriptions.
# It has the following form:
# DPP_EMAIL="..."
# DPP_PASSWORD="..."
source ~/.secrets/dpp-keys-minio
ip_addr=$(ip -o -4 addr list eno2 | awk '{print $4}' | cut -d/ -f1)
DTS_CONFIG_REF="refs/heads/develop"
DTS_CONFIG_HASH=$(git ls-remote https://github.com/Dasharo/dts-configs.git "${DTS_CONFIG_REF}" | awk '{print $1}')
echo "Using DTS config hash: ${DTS_CONFIG_HASH}"
echo "::add-mask::$DPP_EMAIL"
echo "::add-mask::$DPP_PASSWORD"
echo "::add-mask::$DPP_EMAIL_FW_ONLY"
echo "::add-mask::$DPP_PASSWORD_FW_ONLY"
echo "::add-mask::$DPP_EMAIL_EXTENSIONS_ONLY"
echo "::add-mask::$DPP_PASSWORD_EXTENSIONS_ONLY"
echo "::add-mask::$DPP_EMAIL_NO_ACCESS"
echo "::add-mask::$DPP_PASSWORD_NO_ACCESS"
RTE_IP="127.0.0.1" CONFIG="qemu" ./scripts/run.sh dts/dts-e2e.robot -- \
-L TRACE \
-v snipeit:no \
-v dpp_email:$DPP_EMAIL \
-v dpp_password:$DPP_PASSWORD \
-v dpp_email_fw_only:$DPP_EMAIL_FW_ONLY \
-v dpp_password_fw_only:$DPP_PASSWORD_FW_ONLY \
-v dpp_email_extensions_only:$DPP_EMAIL_EXTENSIONS_ONLY \
-v dpp_password_extensions_only:$DPP_PASSWORD_EXTENSIONS_ONLY \
-v dpp_email_no_access:$DPP_EMAIL_NO_ACCESS \
-v dpp_password_no_access:$DPP_PASSWORD_NO_ACCESS \
-v boot_dts_from_ipxe_shell:True \
-v dts_config_ref:"${DTS_CONFIG_REF}" \
-v dts_ipxe_link:http://${ip_addr}:4321/dts.ipxe 2>&1 \
| tee ${{ env.LOG_DIR }}/dts-tests.log | grep --line-buffered "| PASS |\|| FAIL |\|| SKIP |\|\[ WARN \]"
- name: Copy log
shell: bash
if: ${{ !cancelled() }}
run: |
cd open-source-firmware-validation
find logs -type f -name "*log.html" -exec mv {} "${{ env.LOG_DIR }}/dts-tests_log.html" \;
cleanup:
name: Cleanup
if: always()
needs: run-tests
runs-on:
labels: dts-builder
steps:
- name: Cleanup after tests
shell: bash
run: |
rm -rf $GITHUB_WORKSPACE; mkdir $GITHUB_WORKSPACE