Skip to content

Commit 9cc08f9

Browse files
committed
added a github CI action that tests the zephyr wolftpm pr
1 parent 8ebbc85 commit 9cc08f9

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

.github/workflows/zephyr.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Zephyr wolfTPM Tests
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ '*' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
# END OF COMMON SECTION
14+
15+
jobs:
16+
run_test:
17+
name: Build and run
18+
strategy:
19+
matrix:
20+
config:
21+
- zephyr-ref: v3.4.0
22+
zephyr-sdk: 0.16.1
23+
runs-on: ubuntu-22.04
24+
# This should be a safe limit for the tests to run.
25+
timeout-minutes: 25
26+
steps:
27+
- name: Install dependencies
28+
run: |
29+
# Don't prompt for anything
30+
export DEBIAN_FRONTEND=noninteractive
31+
sudo apt-get update
32+
# most of the ci-base zephyr docker image packages
33+
sudo apt-get install -y zip bridge-utils uml-utilities \
34+
git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget \
35+
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
36+
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 \
37+
autoconf automake bison build-essential ca-certificates cargo ccache chrpath cmake \
38+
cpio device-tree-compiler dfu-util diffstat dos2unix doxygen file flex g++ gawk gcc \
39+
gcovr git git-core gnupg gperf gtk-sharp2 help2man iproute2 lcov libcairo2-dev \
40+
libglib2.0-dev libgtk2.0-0 liblocale-gettext-perl libncurses5-dev libpcap-dev \
41+
libpopt0 libsdl1.2-dev libsdl2-dev libssl-dev libtool libtool-bin locales make \
42+
net-tools ninja-build openssh-client parallel pkg-config python3-dev python3-pip \
43+
python3-ply python3-setuptools python-is-python3 qemu-kvm rsync socat srecord sudo \
44+
texinfo unzip wget ovmf xz-utils
45+
46+
- name: Install west
47+
run: sudo pip install west
48+
49+
- name: Init west workspace
50+
run: west init --mr ${{ matrix.config.zephyr-ref }} zephyr
51+
52+
- name: Update west.yml
53+
working-directory: zephyr/zephyr
54+
run: |
55+
EF=$(echo '${{ github.ref }}' | sed -e 's/\//\\\//g')
56+
sed -e 's/remotes:/remotes:\n \- name: wolfssl\n url\-base: https:\/\/github.com\/wolfssl/' -i west.yml
57+
sed -e "s/remotes:/remotes:\n \- name: wolftpm\n url\-base: https:\/\/github.com\/${{ github.repository_owner }}/" -i west.yml
58+
sed -e "s/projects:/projects:\n \- name: wolftpm\n path: modules\/lib\/wolftpm\n remote: wolftpm\n revision: $REF/" -i west.yml
59+
sed -e 's/projects:/projects:\n \- name: wolfssl\n path: modules\/crypto\/wolfssl\n remote: wolfssl\n revision: master/' -i west.yml
60+
61+
- name: Update west workspace
62+
working-directory: zephyr
63+
run: west update -n -o=--depth=1
64+
65+
- name: Export zephyr
66+
working-directory: zephyr
67+
run: west zephyr-export
68+
69+
- name: Install pip dependencies
70+
working-directory: zephyr
71+
run: sudo pip install -r zephyr/scripts/requirements.txt
72+
73+
- name: Install zephyr SDK
74+
run: |
75+
wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${{ matrix.config.zephyr-sdk }}/zephyr-sdk-${{ matrix.config.zephyr-sdk }}_linux-x86_64_minimal.tar.xz
76+
tar xf zephyr-sdk-${{ matrix.config.zephyr-sdk }}_linux-x86_64_minimal.tar.xz
77+
cd zephyr-sdk-${{ matrix.config.zephyr-sdk }}
78+
./setup.sh -h -c -t x86_64-zephyr-elf
79+
80+
- name: Fix options for 2.7.4
81+
if: ${{ matrix.config.zephyr-ref == 'v2.7.4' }}
82+
working-directory: zephyr/modules/lib/wolftpm
83+
run: |
84+
sed -i -e 's/CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE/CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE/g' $(find -name prj.conf)
85+
86+
- name: Run wolftpm wrap test
87+
id: wolftpm-wrap-test
88+
working-directory: zephyr
89+
run: |
90+
./zephyr/scripts/twister -T modules/lib/wolftpm --test zephyr/samples/wolftpm_wrap_test/sample.lib.wolftpm_wrap_test -vvv
91+
rm -rf zephyr/twister-out
92+
93+
- name: Run wolftpm wrap caps
94+
id: wolftpm-wrap-caps
95+
working-directory: zephyr
96+
run: |
97+
./zephyr/scripts/twister -T modules/lib/wolftpm --test zephyr/samples/wolftpm_wrap_caps/sample.lib.wolftpm_wrap_caps -vvv
98+
rm -rf zephyr/twister-out
99+
100+
- name: Zip failure logs
101+
if: ${{ failure() && (steps.wolftpm-wrap-test.outcome == 'failure' || steps.wolftpm-wrap-caps.outcome == 'failure') }}
102+
run: |
103+
zip -9 -r logs.zip zephyr/twister-out
104+
105+
- name: Upload failure logs
106+
if: ${{ failure() && (steps.wolftpm-wrap-test.outcome == 'failure' || steps.wolftpm-wrap-caps.outcome == 'failure') }}
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: zephyr-client-test-logs
110+
path: logs.zip
111+
retention-days: 5

0 commit comments

Comments
 (0)