Skip to content

Commit

Permalink
ci: add .deb build job
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Whisonant <tim.whisonant@intel.com>
  • Loading branch information
tswhison committed Dec 20, 2022
1 parent 9a2be62 commit 26d850f
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build-debs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build DEBs

on:
push:
branches:
- master
pull_request:
branches: [master]
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
DEB:
strategy:
matrix:
distro: [ubuntu22]
runs-on: ubuntu-latest
name: Build ${{ matrix.distro }}
steps:
- uses: actions/checkout@v2
- name: Build Docker Image
run: docker build . -f docker/${{ matrix.distro }}/Dockerfile -t opae-${{ matrix.distro }}
- name: Build DEBs
run: |
docker run --rm -v ${{ github.workspace }}:/opae-${{ matrix.distro }}/opae-sdk opae-${{ matrix.distro }} /opae-${{ matrix.distro }}/opae-sdk
- name: Install and Test DEBs
if: ${{ github.event_name != 'pull_request'}}
run: |
docker run --rm -v ${{ github.workspace }}:/opae-${{ matrix.distro }}/opae-sdk --workdir /opae-${{ matrix.distro }}/opae-sdk --entrypoint /bin/bash opae-${{ matrix.distro }} -c "/scripts/test-debs.sh"
- name: Upload Artifact
if: ${{ github.event_name != 'pull_request'}}
uses: actions/upload-artifact@v2.1.4
with:
name: OPAE-${{ matrix.distro }}
path:
${{ matrix.distro }}/opae-sdk/packaging/opae/deb/*.deb

8 changes: 8 additions & 0 deletions docker/ubuntu22/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:22.04
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip python3-dev git gcc g++ make cmake uuid-dev libjson-c-dev libhwloc-dev libtbb-dev libedit-dev libudev-dev bsdmainutils devscripts debhelper dh-python
RUN python3 -m pip install setuptools --upgrade --prefix=/usr
RUN python3 -m pip install pyyaml jsonschema pybind11
WORKDIR /root
COPY scripts/build-debs.sh /scripts/build-debs.sh
COPY scripts/test-debs.sh /scripts/test-debs.sh
ENTRYPOINT ["/scripts/build-debs.sh"]
11 changes: 11 additions & 0 deletions scripts/build-debs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -x

src=$(realpath ${1:-$PWD})

cmake=cmake
if ! command -v cmake > /dev/null && command -v cmake3 > /dev/null; then
cmake=cmake3
fi

${src}/packaging/opae/deb/create
52 changes: 52 additions & 0 deletions scripts/test-debs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
debdir=$(realpath ${1:-$PWD})
debdir="${debdir}/packaging/opae/deb"

apt-get install -y $debdir/opae*.deb
if [ $? -ne 0 ]; then
echo "Could not install OPAE DEBs"
exit 1
fi

failures=0
test_exit_code(){
expected_code=$1
shift
cmd="$@"
echo "testing: $cmd"
$cmd > output.dat
actual_code=$?
if [ $expected_code != $actual_code ]; then
failures=$(echo 1+$failures | bc)
echo "$cmd: expected $expected_code, got $actual_code" >> errors.txt
cat output.dat
fi
}

if [ -f errors.txt ]; then
unlink errors.txt
fi

test_exit_code 0 "fpgainfo -h"
test_exit_code 1 "fpgaconf -h"
test_exit_code 0 "pci_device -h"
test_exit_code 0 "fpgasupdate -h"
test_exit_code 0 "hssi -h"
test_exit_code 0 "dummy_afu -h"
test_exit_code 0 "opae.io -h"
test_exit_code 0 "PACSign -h"
test_exit_code 1 "fpgadiag -h"
test_exit_code 100 "fpgadiag -m lpbk1 -h"
test_exit_code 100 "fpgadiag -m read -h"
test_exit_code 100 "fpgadiag -m write -h"
test_exit_code 100 "fpgadiag -m trput -h"

dd if=/dev/urandom of=dummy.bin bs=1 count=1024 2> /dev/null
test_exit_code 0 \
"PACSign PR -H openssl_manager -t UPDATE -y -i dummy.bin -o dummy.signed"
echo "unexpected exit codes shown below"
if [ -f errors.txt ]; then
cat errors.txt
fi
echo "failures: $failures"
exit $failures

0 comments on commit 26d850f

Please sign in to comment.