.github/workflows/test.yml: Improve test workflow #69
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 \ | |
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" DPP_PASSWORD="$DPP_PASSWORD" DPP_DOWNLOAD_KEY="${{matrix.dpp_download_key}}" DPP_LOGS_KEY="${{matrix.dpp_logs_key}}" NETBOOT_UTILITIES_SUPPORT="True" DTS_IPXE_LINK="http://${ip_addr}:4321/dts.ipxe" ./scripts/run.sh dts/dts-e2e.robot -- -L TRACE -v snipeit:no \ | |
-i ${{ matrix.test }} 2>&1 \ | |
| tee ${{ env.LOG_DIR }}/${{ matrix.log_file }} | grep "| PASS |\|| FAIL |" | |
- name: Copy log | |
shell: bash | |
if: ${{ !cancelled() }} | |
run: | | |
cp open-source-firmware-validation/log.html ${{ env.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: | | |
rm -rf $GITHUB_WORKSPACE; mkdir $GITHUB_WORKSPACE |