Skip to content

Commit

Permalink
.github/workflows/test.yml: Fix
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Langowski <[email protected]>
  • Loading branch information
PLangowski committed Nov 21, 2024
1 parent 0bd2bae commit 379f816
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 72 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@
name: Build DTS
on:
workflow_call:
inputs:
cacheless:
type: boolean
required: true

jobs:
build:
runs-on:
labels: dts-builder
steps:
- name: Checkout meta-dts repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: "meta-dts"
- name: Prepare cache-less build configuration
if: ${{ inputs.cacheless }}
shell: bash
run: |
sed -i '/cache.yml/d' meta-dts/kas.yml
- name: Build DTS image
shell: bash
id: build_image
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
build:
uses: ./.github/workflows/build.yml
with:
cacheless: false
deploy-images:
name: Deploy DTS artifacts on boot.dasharo.com and GitHub Release
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
build:
uses: ./.github/workflows/build.yml
with:
cacheless: false
deploy-images:
name: Deploy DTS artifacts on boot.dasharo.com
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
Expand Down
101 changes: 73 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
name: CI on push release tag
name: Run DTS tests
on:
pull_request:
branches:
- 'main'
jobs:
build-dts:
uses: ./.github/workflows/build.yml
with:
cacheless: false
run-tests:
name: Run DTS tests
if: ${{ github.head_ref == 'develop' && contains(join(needs.*.result, ','), 'success') }}
Expand All @@ -21,18 +23,19 @@ jobs:
path: 'open-source-firmware-validation'
submodules: 'recursive'
ref: 'develop'
- name: Copy DTS binary
- name: Run IPXE server
shell: bash
run: |
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: Set up Python
uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: '3.12'
mkdir ipxe
cp build/tmp/deploy/images/genericx86-64/dts-base-image-genericx86-64.cpio.gz ipxe
cp build/tmp/deploy/images/genericx86-64/bzImage ipxe
echo -e "\n
#!ipxe\n
imgfetch --name file_kernel bzImage\n
imgfetch --name file_initrd dts-base-image-genericx86-64.cpio.gz\n
kernel file_kernel root=/dev/nfs initrd=file_initrd\n
boot" > ipxe/dts.ipxe
cd ipxe && python3-m http.server 4321 &
- name: Install requirements
shell: bash
run: |
Expand All @@ -44,9 +47,9 @@ jobs:
shell: bash
id: run_qemu
run: |
HDD_PATH=./scripts/ci/qemu-data/dts.img ./scripts/ci/qemu-run.sh nographic os &
pid=$!
echo "qemu_pid=$pid" >> "$GITHUB_OUTPUT"
cd open-source-firmware-validation/scripts/ci
qemu-img create -f qcow2 qemu-data/hdd.qcow 20G
./qemu-run.sh nographic os &
- name: Create directory for logs
shell: bash
id: log_dirs
Expand All @@ -55,30 +58,72 @@ jobs:
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: |
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)
robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -v snipeit:no \
-v dpp_password:$DPP_PASSWORD -v dpp_download_key:$MSI_DOWNLOAD \
-v dpp_logs_key:$MSI_LOGS -v netboot_utilities_support:True \
-v dts_ipxe_link:http://${ip_addr}:4321/dts.ipxe
-i "msi" dts/dts-e2e.robot 2>&1 | tee $LOG_DIR/output_msi.log | grep "| PASS |\|| FAIL |"
robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -v snipeit:no \
-v dpp_password:$DPP_PASSWORD -v dpp_download_key:$MSI_HEADS_DOWNLOAD \
-v dpp_logs_key:$MSI_HEADS_LOGS -v netboot_utilities_support:True \
-v dts_ipxe_link:http://${ip_addr}:4321/dts.ipxe
-i "msi_heads" dts/dts-e2e.robot 2>&1 | tee $LOG_DIR/output_msi_heads.log | grep "| PASS |\|| FAIL |"
robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -v snipeit:no \
-v dpp_password:$DPP_PASSWORD -v dpp_download_key:$OPTIPLEX_DOWNLOAD \
-v dpp_logs_key:$OPTIPLEX_LOGS -v netboot_utilities_support:True \
-v dts_ipxe_link:http://${ip_addr}:4321/dts.ipxe
-i "optiplex" dts/dts-e2e.robot 2>&1 | tee $LOG_DIR/output_optiplex.log | grep "| PASS |\|| FAIL |"
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 |"
-v dpp_password:$DPP_PASSWORD -v dpp_download_key:$NOVACUSTOM_HEADS_DOWNLOAD \
-v dpp_logs_key:$NOVACUSTOM_HEADS_LOGS -v netboot_utilities_support:True \
-v dts_ipxe_link:http://${ip_addr}:4321/dts.ipxe
-i "novacustom_heads" dts/dts-e2e.robot 2>&1 | tee $LOG_DIR/output_nc_heads.log | grep "| PASS |\|| FAIL |"
robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -v snipeit:no \
-v dpp_password:$DPP_PASSWORD -v dpp_download_key:$PCENGINES_DOWNLOAD \
-v dpp_logs_key:$PCENGINES_LOGS -v netboot_utilities_support:True \
-v dts_ipxe_link:http://${ip_addr}:4321/dts.ipxe
-i "pcengines" dts/dts-e2e.robot 2>&1 | tee $LOG_DIR/output_pcengines.log | grep "| PASS |\|| FAIL |"
robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -v snipeit:no \
-v dpp_password:$DPP_PASSWORD -v dpp_download_key:$PCENGINES_SEABIOS_DOWNLOAD \
-v dpp_logs_key:$PCENGINES_SEABIOS_LOGS -v netboot_utilities_support:True \
-v dts_ipxe_link:http://${ip_addr}:4321/dts.ipxe
-i "pcengines_seabios" dts/dts-e2e.robot 2>&1 | tee $LOG_DIR/output_pcengines_seabios.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
- name: Cleanup
if: always()
cp open-source-firmware-validation/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: |
deactivate
qemu_pid="${{ steps.run_qemu.outputs.qemu_pid }}"
if [ ! -z "$qemu_pid" ]; then
kill $qemu_pid
fi
cd ..
rm -rf open-source-firmware-validation meta-dts
rm -rf open-source-firmware-validation meta-dts build ipxe
46 changes: 3 additions & 43 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,9 @@ on:

jobs:
build:
name: Build system image without using cache
runs-on:
labels: dts-builder
steps:
- name: Prepare SSH key
shell: bash
env:
SSH_KEY: ${{secrets.SSH_KEY}}
run: |
echo -e ${SSH_KEY} > ~/.ssh/dts-ci-key
chmod 600 ~/.ssh/dts-ci-key
- name: Checkout meta-dts repo
uses: actions/checkout@v2
with:
path: "meta-dts"
- name: Prepare cache-less build configuration
shell: bash
run: |
sed -i '/cache.yml/d' meta-dts/kas.yml
- name: Build DTS image
shell: bash
id: build_image
run: |
for attempt in {1..5}; do
if kas-container build meta-dts/kas.yml; then
echo "Build command succeeded on attempt $attempt"
break
else
echo "Build command failed on attempt $attempt"
if [ $attempt -lt 5 ]; then
sleep 5
fi
fi
done
continue-on-error: true
- name: Report build command
run: |
if [ ${{ steps.build_image.outcome }} == 'failure' ]; then
echo "All build attempts failed."
exit 1
else
echo "At least one build attempt succeeded."
fi
uses: ./.github/workflows/build.yml
with:
cacheless: true
deploy-cache:
name: Deploy cache on cache.dasharo.com
if: always()
Expand Down

0 comments on commit 379f816

Please sign in to comment.