diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..dcc3ec1ba --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:22.04 + +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get update && apt-get -y install \ + clang-format \ + clang-tidy \ + cmake \ + doxygen \ + graphviz \ + git \ + g++ \ + libssl-dev \ + 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" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..08052ae18 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,13 @@ +{ + "name": "Ubuntu 22.04 with OpenSSL 3.0", + "build": { + "dockerfile": "Dockerfile" + }, + "customizations": { + "vscode": { + "extensions": [ + "streetsidesoftware.code-spell-checker" + ] + } + } +} diff --git a/.devcontainer/wolfssl/Dockerfile b/.devcontainer/wolfssl/Dockerfile new file mode 100644 index 000000000..64eb243b7 --- /dev/null +++ b/.devcontainer/wolfssl/Dockerfile @@ -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" diff --git a/.devcontainer/wolfssl/devcontainer.json b/.devcontainer/wolfssl/devcontainer.json new file mode 100644 index 000000000..e69de29bb diff --git a/.github/actions/install/wolfssl/action.yml b/.github/actions/install/wolfssl/action.yml index bced14743..b7e2600fa 100644 --- a/.github/actions/install/wolfssl/action.yml +++ b/.github/actions/install/wolfssl/action.yml @@ -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 ${{ inputs.version }} + sudo rm -rf /usr/include/openssl shell: bash diff --git a/.github/actions/install/wolfssl/install.sh b/.github/actions/install/wolfssl/install.sh new file mode 100755 index 000000000..73c9754eb --- /dev/null +++ b/.github/actions/install/wolfssl/install.sh @@ -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 [ "$(id -u)" -ne 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-* diff --git a/.github/workflows/jwt.yml b/.github/workflows/jwt.yml index 46eed9718..9345754b7 100644 --- a/.github/workflows/jwt.yml +++ b/.github/workflows/jwt.yml @@ -93,3 +93,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 . diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6d8410b39..3b5ea8e94 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -75,8 +75,6 @@ jobs: name: render-defaults (${{ matrix.traits.name }}) steps: - uses: actions/checkout@v4 - - run: | - sudo apt-get install clang-format-14 - uses: ./.github/actions/render/defaults id: render with: @@ -84,7 +82,7 @@ jobs: library_name: ${{ matrix.traits.library }} library_url: ${{ matrix.traits.url }} disable_default_traits: ${{ matrix.traits.disable_pico }} - - run: clang-format-14 -i ${{ steps.render.outputs.file_path }} + - run: clang-format -i ${{ steps.render.outputs.file_path }} - run: git add ${{ steps.render.outputs.file_path }} - uses: ./.github/actions/process-linting-results with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc6a18ff9..0e824d226 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,4 +41,4 @@ jobs: - uses: shogo82148/actions-upload-release-asset@v1 with: upload_url: ${{ github.event.release.upload_url }} - asset_path: /tmp/jwt-cpp-${{ github.event.release.tag_name }}.zip + asset_path: /tmp/jwt-cpp-${{ github.event.release.tag_name }}.zip