Skip to content

Commit

Permalink
devcontainers fix, test and add wolfssl
Browse files Browse the repository at this point in the history
refactored installer to have a script that could be reused
  • Loading branch information
prince-chrismc committed Jan 11, 2024
1 parent 0129f53 commit 99bcb7f
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM ubuntu:22.04

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt-get -y install \
clang++ \
clang-format \
clang-tidy \
cmake \
Expand All @@ -14,4 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
libgtest-dev \
&& rm -rf /var/lib/apt/lists/*

ENV CMAKE_C_FLAGS="-DOPENSSL_NO_DEPRECATED=1"
ENV CMAKE_CXX_FLAGS="-DOPENSSL_NO_DEPRECATED=1"
ENV CMAKE_C_CLANG_TIDY="clang-tidy;-fix"
ENV CMAKE_CXX_CLANG_TIDY="clang-tidy;-fix"
25 changes: 25 additions & 0 deletions .devcontainer/wolfssl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:22.04

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt-get -y install \
autoconf \
build-essential \
clang-format \
clang-tidy \
cmake \
doxygen \
graphviz \
git \
g++ \
libgtest-dev \
libtool \
wget \
&& rm -rf /var/lib/apt/lists/*

# https://www.warp.dev/terminus/dockerfile-run-sh
COPY ./.github/actions/install/wolfssl/install.sh /wolfssl/install.sh
RUN /wolfssl/install.sh

ENV JWT_SSL_LIBRARY="wolfSSL"
ENV CMAKE_C_CLANG_TIDY="clang-tidy;-fix"
ENV CMAKE_CXX_CLANG_TIDY="clang-tidy;-fix"
Empty file.
12 changes: 2 additions & 10 deletions .github/actions/install/wolfssl/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ runs:
using: composite
steps:
- run: |
cd /tmp
wget -O wolfssl.tar.gz https://github.com/wolfSSL/wolfssl/archive/${{ inputs.version }}.tar.gz
tar -zxf /tmp/wolfssl.tar.gz
cd wolfssl-*
autoreconf -fiv
./configure --enable-opensslall --enable-opensslextra --disable-examples --disable-crypttests --enable-harden --enable-all --enable-all-crypto
make
sudo make install
shell: bash
- run: sudo rm -rf /usr/include/openssl
./.github/actions/install/wolfssl/install.sh
sudo rm -rf /usr/include/openssl
shell: bash
25 changes: 25 additions & 0 deletions .github/actions/install/wolfssl/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /bin/sh
set -e # Exit on error
DEFAULT_VERSION="v5.3.0-stable"
VERSION="${1:-$DEFAULT_VERSION}"

cd /tmp
wget -O wolfssl.tar.gz https://github.com/wolfSSL/wolfssl/archive/$VERSION.tar.gz
tar -zxf wolfssl.tar.gz
cd wolfssl-*
autoreconf -fiv
./configure --prefix=/usr/local --enable-opensslall --enable-opensslextra --disable-examples --disable-crypttests --enable-harden --enable-all --enable-all-crypto
make

# Depending if we run in on a GitHub Actions or from within a Docker image we have different permissions
if [[ $EUID > 0 ]]; then
# If we are not root then we need to sudo
sudo make install
else
# Default docker image does not have users setup so we are only root and can not sudo
make install
fi

cd /tmp
rm wolfssl.tar.gz
rm -rf wolfssl-*
7 changes: 7 additions & 0 deletions .github/workflows/jwt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,10 @@ jobs:
cmake --build --preset ci-ubsan --target rsa-verify-run
cmake --build --preset ci-ubsan --target jwks-verify-run
cmake --build --preset ci-ubsan --target jwt-cpp-test-run
devcontainers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t default -f .devcontainer/Dockerfile
- run: docker build -t wolfssl -f .devcontainer/wolfssl/Dockerfile

0 comments on commit 99bcb7f

Please sign in to comment.