Skip to content

Commit

Permalink
Merge pull request #18 from dr8co/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dr8co authored Jun 28, 2024
2 parents da866ba + f41889a commit 4e27712
Show file tree
Hide file tree
Showing 39 changed files with 2,254 additions and 1,395 deletions.
25 changes: 25 additions & 0 deletions .github/cancelled_workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- dev
- main

jobs:
qodana:
runs-on: ubuntu-24.04
permissions:
contents: write
pull-requests: write
checks: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2024.1
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
149 changes: 38 additions & 111 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,158 +3,85 @@ name: CMake Build
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ${{ matrix.os }}
env:
GCC_MAJOR: 14

strategy:
fail-fast: false

matrix:
os: [ ubuntu-latest, macos-13 ]
build_type: [ Debug, Release ]
os: [ ubuntu-24.04, macos-latest ]
build_type: [ Debug ]
c_compiler: [ clang ]
include:
- os: macos-13
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
env:
LDFLAGS=: "-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
CPPFLAGS: "-I/usr/local/opt/llvm/include I/usr/local/opt/llvm/include/c++/v1"
LD_LIBRARY_PATH: "/usr/local/opt/llvm/lib"
DYLD_LIBRARY_PATH: "/usr/local/opt/llvm/lib"
cpp_compiler: clang++-18

# - os: macos-13
# c_compiler: gcc
# cpp_compiler: g++-13
#
# - os: ubuntu-latest
# c_compiler: gcc
# cpp_compiler: g++-13

- os: ubuntu-latest
- os: ubuntu-24.04
c_compiler: clang
cpp_compiler: clang++-17

# Don't include the following configurations in the matrix
exclude:
- os: macos-13
build_type: Debug
cpp_compiler: clang++-18

steps:
# Install dependencies: cmake, ninja, gcc, libgcrypt, openssl, readline, and libsodium
- name: Install Dependencies
if: matrix.os == 'macos-13'
if: matrix.os == 'macos-latest'
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=TRUE
brew update
brew install llvm cmake ninja gcc libgcrypt openssl@3 readline libsodium
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/gcc@13/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/gcc@13/lib/gcc/13:$PATH"' >> ~/.bash_profile
# - name: Install Dependencies
# if: matrix.os == 'ubuntu-latest'
# run: |
# wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
# sudo add-apt-repository -y "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
# sudo add-apt-repository -y ppa:ubuntu-toolchain-r/ppa
# sudo apt update
# sudo apt install -y cmake ninja-build gcc-13 g++-13 clang-17 lldb-17 lld-17 libc++-17-dev libc++abi-17-dev \
# libomp-17-dev libgcrypt20 openssl libreadline8 libsodium23 libsodium-dev

brew install ninja cmake git gcc@${{ env.GCC_MAJOR }}
brew reinstall llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/opt/homebrew/opt/gcc/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/opt/homebrew/opt/gcc/lib/gcc/${{ env.GCC_MAJOR }}:$PATH"' >> ~/.bash_profile
. ~/.bash_profile
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
working-directory: ${{ github.workspace }}
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
# Build project
# Set the paths to the GCC include and lib directories on macOS
if [ "${{ matrix.os }}" == "macos-latest" ]; then
echo "gcc-include-dir=$(./scripts/search.sh "/opt/homebrew/Cellar/gcc/${{ env.GCC_MAJOR }}*/include/c++/${{ env.GCC_MAJOR }}")" >> "$GITHUB_OUTPUT"
echo "gcc-sys-include-dir=$(./scripts/search.sh "/opt/homebrew/Cellar/gcc/${{ env.GCC_MAJOR }}*/include/c++/${{ env.GCC_MAJOR }}/*-apple-darwin*")" >> "$GITHUB_OUTPUT"
echo "gcc-lib-dir=$(./scripts/search.sh "/opt/homebrew/Cellar/gcc/${{ env.GCC_MAJOR }}*/lib/gcc/current")" >> "$GITHUB_OUTPUT"
fi
# Build the project
- name: Build PrivacyShield
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-24.04'
run: |
sudo ./scripts/buildscript.sh
# OS=${{ matrix.os }}
# COMMAND="./scripts/install-blake3.sh ${{ matrix.c_compiler }}"
# if [ "$OS" == "macos-13" ]; then
# $COMMAND
# elif [ "$OS" == "ubuntu-latest" ]; then
# sudo $COMMAND
# fi
#
sudo ./scripts/build.sh
- name: Install Blake3
if: matrix.os == 'macos-13'
if: matrix.os == 'macos-latest'
run: |
./scripts/install-blake3.sh ${{ matrix.c_compiler }}
sudo ./scripts/install-blake3.sh ${{ matrix.c_compiler }}
- name: Configure CMake
if: matrix.os == 'macos-13'
if: matrix.os == 'macos-latest'
run: >
export LDFLAGS="-L/usr/local/opt/gcc@13/lib/gcc/13 -Wl,-rpath,/usr/local/opt/gcc@13/lib/gcc/13";
export CPPFLAGS="-I/usr/local/opt/gcc@13/include/c++/13 -I/usr/local/opt/gcc@13/include/c++/13/x86_64-apple-darwin22";
export LD_LIBRARY_PATH="/usr/local/opt/gcc@13/lib/gcc/13";
export DYLD_LIBRARY_PATH="/usr/local/opt/gcc@13/lib/gcc/13";
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++
-DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang
-DCMAKE_CXX_FLAGS="-I/usr/local/opt/gcc@13/include/c++/13 -I/usr/local/opt/gcc@13/include/c++/13/x86_64-apple-darwin22 -L/usr/local/opt/gcc@13/lib/gcc/13 -Wl,-rpath,/usr/local/opt/gcc@13/lib/gcc/13 -stdlib=libstdc++"
-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++
-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang
-DCMAKE_CXX_FLAGS="-stdlib++-isystem ${{ steps.strings.outputs.gcc-include-dir }} -cxx-isystem ${{ steps.strings.outputs.gcc-sys-include-dir }}"
-DCMAKE_EXE_LINKER_FLAGS="-stdlib=libstdc++ -L ${{ steps.strings.outputs.gcc-lib-dir }} -Wl,-rpath,/opt/homebrew/opt/gcc/lib/gcc/current"
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }} -G Ninja
# -DCMAKE_CXX_FLAGS="-stdlib=libstdc++ -stdlib++-isystem /opt/homebrew/Cellar/gcc/14.1.0_1/include/c++/14 -cxx-isystem /opt/homebrew/Cellar/gcc/14.1.0_1/include/c++/14/aarch64-apple-darwin23 -L /opt/homebrew/Cellar/gcc/14.1.0_1/lib/gcc/14 -Wl,-rpath,/opt/homebrew/opt/gcc/lib/gcc/current"
- name: Build
if: matrix.os == 'macos-13'
if: matrix.os == 'macos-latest'
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j 4
#
# - name: Test
# working-directory: ${{ steps.strings.outputs.build-output-dir }}
# # Execute tests defined by the CMake configuration
# run: ctest --build-config ${{ matrix.build_type }}
#
- name: Package
if: matrix.os == 'macos-13' && matrix.build_type == 'Release'
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cpack -G DragNDrop

- name: Package
if: matrix.os == 'ubuntu-latest' && matrix.build_type == 'Release'
# Run Tests
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
sudo cpack
sudo chown -R $USER:$USER "${{ github.workspace }}/Packages"
- name: Import GPG Key
if: matrix.build_type == 'Release'
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }}
passphrase: ${{ secrets.GPG_PASS }}
trust_level: 5

- name: Sign Package
if: matrix.build_type == 'Release'
working-directory: ${{ github.workspace }}
run: |
for file in Packages/*; do
gpg --batch --status-file ~/gpg_log.txt --passphrase ${{ secrets.GPG_PASS }} --default-key dr8co@duck.com \
--pinentry-mode=loopback --detach-sign "$file" || (cat ~/gpg_log.txt && exit 1)
done
#
# # Upload the built artifacts
- name: Upload Artifacts
if: matrix.build_type == 'Release'
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.os }}-${{ matrix.build_type }}"
path: "${{ github.workspace }}/Packages"
overwrite: true
if-no-files-found: 'warn'

run: ctest -j 4
121 changes: 121 additions & 0 deletions .github/workflows/cpack-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: CPack Multi-Platform

on:
pull_request:
branches: [ "main" ]

jobs:
build_then_package:
runs-on: ${{ matrix.os }}
env:
GCC_MAJOR: 14

strategy:
fail-fast: false

matrix:
os: [ ubuntu-24.04, macos-latest ]
build_type: [ Release ]
c_compiler: [ clang ]
include:
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++-18

- os: ubuntu-24.04
c_compiler: clang
cpp_compiler: clang++-18

steps:
- name: Install Dependencies
if: matrix.os == 'macos-latest'
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=TRUE
brew update
brew install ninja cmake git gcc@${{ env.GCC_MAJOR }}
brew reinstall llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/opt/homebrew/opt/gcc/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/opt/homebrew/opt/gcc/lib/gcc/${{ env.GCC_MAJOR }}:$PATH"' >> ~/.bash_profile
. ~/.bash_profile
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
working-directory: ${{ github.workspace }}
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
# Set the paths to the GCC include and lib directories on macOS
if [ "${{ matrix.os }}" == "macos-latest" ]; then
echo "gcc-include-dir=$(./scripts/search.sh "/opt/homebrew/Cellar/gcc/*/include/c++/${{ env.GCC_MAJOR }}")" >> "$GITHUB_OUTPUT"
echo "gcc-sys-include-dir=$(./scripts/search.sh "/opt/homebrew/Cellar/gcc/*/include/c++/${{ env.GCC_MAJOR }}/*-apple-darwin*")" >> "$GITHUB_OUTPUT"
echo "gcc-lib-dir=$(./scripts/search.sh "/opt/homebrew/Cellar/gcc/${{ env.GCC_MAJOR }}*/lib/gcc/current")" >> "$GITHUB_OUTPUT"
fi
# Build the project
- name: Build PrivacyShield
if: matrix.os == 'ubuntu-24.04'
run: |
sudo ./scripts/build.sh
- name: Install Blake3
if: matrix.os == 'macos-latest'
run: |
sudo ./scripts/install-blake3.sh ${{ matrix.c_compiler }}
- name: Configure CMake
if: matrix.os == 'macos-latest'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++
-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang
-DCMAKE_CXX_FLAGS="-stdlib++-isystem ${{ steps.strings.outputs.gcc-include-dir }} -cxx-isystem ${{ steps.strings.outputs.gcc-sys-include-dir }}"
-DCMAKE_EXE_LINKER_FLAGS="-stdlib=libstdc++ -L ${{ steps.strings.outputs.gcc-lib-dir }} -Wl,-rpath,/opt/homebrew/opt/gcc/lib/gcc/current"
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }} -G Ninja
- name: Build
if: matrix.os == 'macos-latest'
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j 4

- name: Package
if: matrix.os == 'macos-latest' && matrix.build_type == 'Release'
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cpack
- name: Package
if: matrix.os == 'ubuntu-24.04' && matrix.build_type == 'Release'
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
sudo cpack
sudo chown -R $USER:$USER "${{ github.workspace }}/Packages"
- name: Import GPG Key
if: matrix.build_type == 'Release'
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }}
passphrase: ${{ secrets.GPG_PASS }}
trust_level: 5

- name: Sign Package
if: matrix.build_type == 'Release'
working-directory: ${{ github.workspace }}
run: |
for file in Packages/*; do
gpg --batch --status-file ~/gpg_log.txt --passphrase ${{ secrets.GPG_PASS }} --default-key dr8co@duck.com \
--pinentry-mode=loopback --detach-sign "$file" || (cat ~/gpg_log.txt && exit 1)
done
# Upload the built artifacts
- name: Upload Artifacts
if: matrix.build_type == 'Release'
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.os }}-${{ matrix.build_type }}"
path: "${{ github.workspace }}/Packages"
overwrite: true
if-no-files-found: 'warn'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
# .idea/modules
# *.iml
# *.ipr
.idea/**/*copilot*

# CMake
cmake-build-*/
Expand Down
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4e27712

Please sign in to comment.