Skip to content

Commit

Permalink
🧰 Linting and maintenance (#120)
Browse files Browse the repository at this point in the history
* some manual fixes to obtain

* fairly close enough

* whitespace fixes

* add comment

* adding clang format + applied

* add editorconfig (supported natively by github web editor)

* apply linting to project

* clean up CI workflows

* zap vcpkg folder

actual one is here
https://github.com/microsoft/vcpkg/tree/master/ports/jwt-cpp

* adding a logo

* thin the lines in the pluses

* use logo + more links to spec and examples

* Create lint.yml

* apply linting
  • Loading branch information
prince-chrismc authored Jan 11, 2021
1 parent ac3de9e commit b21d80c
Show file tree
Hide file tree
Showing 45 changed files with 2,418 additions and 2,524 deletions.
22 changes: 22 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
BasedOnStyle: LLVM
BreakBeforeBraces: Attach

ColumnLimit: 120 # Match GitHub UI

UseTab: Always
TabWidth: 4
IndentWidth: 4
AccessModifierOffset: -4
ContinuationIndentWidth: 4
NamespaceIndentation: All
IndentCaseLabels: false

PointerAlignment: Left
AlwaysBreakTemplateDeclarations: Yes
SpaceAfterTemplateKeyword: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortBlocksOnASingleLine: Always

FixNamespaceComments: true
ReflowComments: false
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[!*.{h,cpp}]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{h,cpp}]
indent_style = tab
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
20 changes: 10 additions & 10 deletions .github/actions/install/gtest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ description: Install and setup GTest for linking and building test application
runs:
using: composite
steps:
- run: sudo apt-get install libgtest-dev lcov
shell: bash
- run: (cd /usr/src/gtest && sudo `which cmake` .)
shell: bash
- run: sudo make -j $(nproc) -C /usr/src/gtest
shell: bash
- run: sudo ln -s /usr/src/gtest/libgtest.a /usr/lib/libgtest.a
shell: bash
- run: sudo ln -s /usr/src/gtest/libgtest_main.a /usr/lib/libgtest_main.a
shell: bash
- run: sudo apt-get install libgtest-dev lcov
shell: bash
- run: (cd /usr/src/gtest && sudo `which cmake` .)
shell: bash
- run: sudo make -j $(nproc) -C /usr/src/gtest
shell: bash
- run: sudo ln -s /usr/src/gtest/libgtest.a /usr/lib/libgtest.a
shell: bash
- run: sudo ln -s /usr/src/gtest/libgtest_main.a /usr/lib/libgtest_main.a
shell: bash
18 changes: 9 additions & 9 deletions .github/actions/install/jsoncons/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ inputs:
version:
description: The desired jsoncons version to install
required: false
default: '0.159.0'
default: "0.159.0"
runs:
using: composite
steps:
- run: |
cd /tmp
wget https://github.com/danielaparker/jsoncons/archive/v${{ inputs.version }}.tar.gz
tar -zvxf /tmp/v${{ inputs.version }}.tar.gz
cd jsoncons-${{ inputs.version }}
cmake .
sudo cmake --install .
shell: bash
- run: |
cd /tmp
wget https://github.com/danielaparker/jsoncons/archive/v${{ inputs.version }}.tar.gz
tar -zvxf /tmp/v${{ inputs.version }}.tar.gz
cd jsoncons-${{ inputs.version }}
cmake .
sudo cmake --install .
shell: bash
20 changes: 10 additions & 10 deletions .github/actions/install/libressl/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ inputs:
version:
description: The desired LibreSSL version to install
required: false
default: '3.3.0'
default: "3.3.0"
runs:
using: composite
steps:
- run: |
wget https://raw.githubusercontent.com/libressl-portable/portable/v${{ inputs.version }}/FindLibreSSL.cmake -P cmake/
cd /tmp
wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${{ inputs.version }}.tar.gz
tar -zvxf /tmp/libressl-${{ inputs.version }}.tar.gz
cd libressl-${{ inputs.version }}
./configure
sudo make -j $(nproc) install
shell: bash
- run: |
wget https://raw.githubusercontent.com/libressl-portable/portable/v${{ inputs.version }}/FindLibreSSL.cmake -P cmake/
cd /tmp
wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${{ inputs.version }}.tar.gz
tar -zvxf /tmp/libressl-${{ inputs.version }}.tar.gz
cd libressl-${{ inputs.version }}
./configure
sudo make -j $(nproc) install
shell: bash
16 changes: 16 additions & 0 deletions .github/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
187 changes: 94 additions & 93 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,119 +1,120 @@
name: CMake Integration CI
name: CMake CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
paths:
- 'CMakeLists.txt'
- 'include/jwt-cpp/**'
- 'tests/cmake/**'
- '.github/workflows/cmake.yml'
- "CMakeLists.txt"
- "include/jwt-cpp/**"
- "tests/cmake/**"
- ".github/actions/**"
- ".github/workflows/cmake.yml"

jobs:
min-req:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install cmake
run: |
wget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz
tar -zxf cmake-3.8.2.tar.gz
cd cmake-3.8.2
./bootstrap && make -j $(nproc) && sudo make install
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DTEST:STRING="defaults-enabled"
cmake --build .
- uses: actions/checkout@v2
- name: install cmake
run: |
wget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz
tar -zxf cmake-3.8.2.tar.gz
cd cmake-3.8.2
./bootstrap && make -j $(nproc) && sudo make install
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DTEST:STRING="defaults-enabled"
cmake --build .
custom-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install cmake
uses: lukka/get-cmake@latest

- name: setup
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="/opt/jwt-cpp" -DJWT_BUILD_EXAMPLES=OFF
make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/opt/jwt-cpp/cmake -DTEST:STRING="defaults-enabled"
cmake --build .
- uses: actions/checkout@v2
- name: install cmake
uses: lukka/get-cmake@latest

- name: setup
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="/opt/jwt-cpp" -DJWT_BUILD_EXAMPLES=OFF
make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/opt/jwt-cpp/cmake -DTEST:STRING="defaults-enabled"
cmake --build .
no-pico:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install cmake
uses: lukka/get-cmake@latest

- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_DISABLE_PICOJSON=ON -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DTEST:STRING="picojson-is-disabled"
cmake --build .
- uses: actions/checkout@v2
- name: install cmake
uses: lukka/get-cmake@latest

- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_DISABLE_PICOJSON=ON -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DTEST:STRING="picojson-is-disabled"
cmake --build .
no-base64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install cmake
uses: lukka/get-cmake@latest

- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_DISABLE_BASE64=ON -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DTEST:STRING="base64-is-disabled"
cmake --build .
- uses: actions/checkout@v2
- name: install cmake
uses: lukka/get-cmake@latest

- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_DISABLE_BASE64=ON -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DTEST:STRING="base64-is-disabled"
cmake --build .
with-libressl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install cmake
uses: lukka/get-cmake@latest
- name: install libressl
uses: ./.github/actions/install/libressl

- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_SSL_LIBRARY:STRING="LibreSSL" -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DCMAKE_MODULE_PATH=../../cmake -DTEST:STRING="libressl-is-used"
cmake --build .
- uses: actions/checkout@v2
- name: install cmake
uses: lukka/get-cmake@latest
- name: install libressl
uses: ./.github/actions/install/libressl

- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_SSL_LIBRARY:STRING="LibreSSL" -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DCMAKE_MODULE_PATH=../../cmake -DTEST:STRING="libressl-is-used"
cmake --build .
Loading

0 comments on commit b21d80c

Please sign in to comment.