Skip to content

.github/workflows/test.yml: Improve test workflow #73

.github/workflows/test.yml: Improve test workflow

.github/workflows/test.yml: Improve test workflow #73

Workflow file for this run

---
name: Run DTS tests
on:
pull_request:
branches:
- "main"
jobs:
# build-dts:
# uses: ./.github/workflows/build.yml
# with:
# cacheless: false
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]
runs-on:
labels: dts-builder
strategy:
fail-fast: false
matrix:
include:
- test: msi_comm
dpp_download_key: $MSI_DOWNLOAD
dpp_logs_key: $MSI_LOGS
log_file: output_msi.log
- test: msi_dpp
dpp_download_key: $MSI_DOWNLOAD
dpp_logs_key: $MSI_LOGS
log_file: output_msi.log
- test: msi_heads
dpp_download_key: $MSI_HEADS_DOWNLOAD
dpp_logs_key: $MSI_HEADS_LOGS
log_file: output_msi_heads.log
- test: optiplex_dpp
dpp_download_key: $OPTIPLEX_DOWNLOAD
dpp_logs_key: $OPTIPLEX_LOGS
log_file: output_nc_heads.log
- test: novacustom_heads
dpp_download_key: $OPTIPLEX_DOWNLOAD
dpp_logs_key: $OPTIPLEX_LOGS
log_file: output_nc_heads.log
- test: novacustom_comm
dpp_download_key: $OPTIPLEX_DOWNLOAD
dpp_logs_key: $OPTIPLEX_LOGS
log_file: output_nc_heads.log
- test: pcengines_dpp
dpp_download_key: $PCENGINES_DOWNLOAD
dpp_logs_key: $PCENGINES_LOGS
log_file: output_pcengines.log
- test: pcengines_seabios
dpp_download_key: $PCENGINES_SEABIOS_DOWNLOAD
dpp_logs_key: $PCENGINES_SEABIOS_LOGS
log_file: output_pcengines_seabios.log
steps:
- name: Run IPXE server
shell: bash
run: ./open-source-firmware-validation/scripts/ci/ipxe-run.sh \
~/dts2.1.0/dts-base-image-v2.1.0.cpio.gz ~/dts-2.1.0/bzImage-v2.1.0
# 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 -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 &
- name: Create directory for logs
shell: bash
id: create_log_dirs
run: |
LOG_DIR="/tmp/dts-test-ci-${{ github.run_id }}/${{ matrix.test }}"
mkdir -p $LOG_DIR
echo "LOG_DIR=$LOG_DIR" >> $GITHUB_ENV
- name: Run ${{ matrix.test }}
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_PASSWORD="..."
# <SUBSCRIPTION_TYPE>_DOWNLOADS="download key"
# <SUBSCRIPTION_TYPE>_LOGS="logs key"
# (...)
source ~/.secrets/dpp-keys
ip_addr=$(ip -o -4 addr list eno2 | awk '{print $4}' | cut -d/ -f1)
echo "::add-mask::${{matrix.dpp_download_key}}"
echo "::add-mask::${{matrix.dpp_logs_key}}"
echo "::add-mask::$DPP_PASSWORD"
RTE_IP="127.0.0.1" CONFIG="qemu" ./scripts/run.sh dts/dts-e2e.robot -- -L TRACE -v snipeit:no -v dpp_password:$DPP_PASSWORD -v dpp_download_key:${{matrix.dpp_download_key}} -v dpp_logs_key="${{matrix.dpp_logs_key}}" -v boot_dts_from_ipxe_shell:True -v dts_ipxe_link:http://${ip_addr}:4321/dts.ipxe \
-i ${{ matrix.test }} 2>&1 \
| tee ${{ env.LOG_DIR }}/${{ matrix.log_file }} | grep "| PASS |\|| FAIL |"
- 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 }}/${{ matrix.test }}_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