Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add findex redis v7 #20

Open
wants to merge 56 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
9027235
feat: add findex impl - client and server sides
Manuthor Oct 18, 2024
7302140
feat: add CSV datasets support in CLI
Manuthor Oct 22, 2024
f45e876
fix: rename IndexAction to AddAction and flatten Findex actions
Manuthor Oct 26, 2024
fcf2bed
Update .pre-commit-config.yaml
Manuthor Oct 27, 2024
fb190a6
fix(auth0): use proper findex-server token
Manuthor Oct 27, 2024
7fa5dd2
test: add JWT authentication tests
Manuthor Oct 28, 2024
f0afc9d
feat: add Delete Findex operation
Manuthor Oct 30, 2024
818c300
fix: remove Secret for now
Manuthor Oct 30, 2024
248ef34
fix: prepare sqlite impl
Manuthor Oct 30, 2024
98936b5
feat: add authorization access mechanism
Manuthor Nov 2, 2024
0b367d6
feat: revoke role
Manuthor Nov 2, 2024
147efd1
docs: cli access
Manuthor Nov 3, 2024
e7dc054
chore: rename FindexClient to RestClient
Manuthor Nov 3, 2024
170f11d
fix: permissions mechanism (#16)
Manuthor Nov 5, 2024
14110b3
feat: encrypt datasets - add routes and write on db
Manuthor Nov 15, 2024
f8fea53
build: docker image
Manuthor Nov 15, 2024
8f976c3
fix: permissions on datasets (add/del/get)
Manuthor Nov 15, 2024
c1f0fa7
chore: split database traits
Manuthor Nov 16, 2024
e0d484b
fix: reuse config_utils
Manuthor Nov 16, 2024
32d25b7
feat: add list_permissions
Manuthor Nov 17, 2024
e3d3e35
fix: strip error conversions
Manuthor Nov 18, 2024
06a3183
ci: merge workflows between debug and release
Manuthor Nov 18, 2024
338770e
docs: add main README
Manuthor Nov 18, 2024
8b0483a
docs: add mkdocs
Manuthor Nov 19, 2024
d3c8392
docs: small changes in mkdocs
Manuthor Nov 20, 2024
7a2e965
chore: reduce verbosity
Manuthor Nov 20, 2024
ddb91b6
ci: include windows build by default
Manuthor Nov 21, 2024
e8f71f3
docs: fix menu
Manuthor Nov 22, 2024
88d6772
fix(config): use only toml format (client and server)
Manuthor Nov 23, 2024
027c5d8
test: index a 3MB dataset
Manuthor Nov 23, 2024
8ceaad4
test: index a 3MB dataset
Manuthor Nov 23, 2024
9fe49ba
fix(redis): use pipe everywhere Redis needs to read/write
Manuthor Nov 23, 2024
0cc0d16
feat: support docker on arm cpu
Manuthor Nov 23, 2024
a0ce487
ci: build ARM docker only on nightly build
Manuthor Nov 23, 2024
d09ab9a
fix: remove pandoc files
Manuthor Nov 25, 2024
88e2652
docs: add CLI usage
Manuthor Nov 26, 2024
5f87dab
fix: use develop branch from http_client_server repo
Manuthor Nov 26, 2024
458cd6d
ci(docker build): remove useless arg
Manuthor Nov 26, 2024
7f9876b
fix: PR review
Manuthor Nov 27, 2024
326c3e1
fix(only docs): PR review
Manuthor Nov 27, 2024
2f093bc
test: add/delete/get datasets
Manuthor Nov 28, 2024
a4366ae
UNSTABLE: wip on redis
HatemMn Dec 2, 2024
9f5de93
UNSTABLE : WIP on redis
HatemMn Dec 3, 2024
3afaaa8
feat : develop findex database struct type
HatemMn Dec 3, 2024
2cdc5ae
feat : findex database trait is working ! yay
HatemMn Dec 3, 2024
6b2fcc1
feat : updates on databases (redis)
HatemMn Dec 5, 2024
9da7d85
feat(server): findex server endpoint implem OK
HatemMn Dec 5, 2024
45ff48e
feat: implement init and clear functions, rename Redis to original name
HatemMn Dec 6, 2024
7728f23
feat: db_params ok
HatemMn Dec 6, 2024
a76f2da
feat: core ok
HatemMn Dec 6, 2024
1d536f5
feat: serialise sresults
HatemMn Dec 6, 2024
d621caa
feat: server build OK
HatemMn Dec 6, 2024
847644b
feat: update findex version and imports
HatemMn Dec 9, 2024
41a5440
chore: clean useless error
HatemMn Dec 9, 2024
8d6f0b0
chore:UNSTABLE WIP on client
HatemMn Dec 9, 2024
86e27e4
feat!: purge cloudproof, add cosmian_crypto_core
HatemMn Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/scripts/cargo_build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
$PSNativeCommandUseErrorActionPreference = $true # might be true by default

function BuildProject {
param (
[Parameter(Mandatory = $true)]
[ValidateSet("debug", "release")]
[string]$BuildType
)

# Add target
rustup target add x86_64-pc-windows-msvc

$env:OPENSSL_DIR = "$env:VCPKG_INSTALLATION_ROOT\packages\openssl_x64-windows-static"
Get-ChildItem -Recurse $env:OPENSSL_DIR

# Build `cosmian_findex_cli`
Get-ChildItem crate\cli
if ($BuildType -eq "release") {
cargo build --release --target x86_64-pc-windows-msvc
}
else {
cargo build --target x86_64-pc-windows-msvc
}
Get-ChildItem ..\..

# Check dynamic links
$output = & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\dumpbin.exe" /dependents target\x86_64-pc-windows-msvc\$BuildType\cosmian_findex_cli.exe | Select-String "libcrypto"
if ($output) {
throw "OpenSSL (libcrypto) found in dynamic dependencies. Error: $output"
}

# Build `server`
Set-Location crate\server
if ($BuildType -eq "release") {
cargo build --release --target x86_64-pc-windows-msvc
cargo test --release --target x86_64-pc-windows-msvc -p cosmian_findex_server -- --nocapture --skip test_findex --skip test_all_authentications --skip test_server_auth_matrix --skip test_datasets
}
else {
cargo build --target x86_64-pc-windows-msvc
cargo test --target x86_64-pc-windows-msvc -p cosmian_findex_server -- --nocapture --skip test_findex --skip test_all_authentications --skip test_server_auth_matrix --skip test_datasets
}
Get-ChildItem ..\..

# Check dynamic links
$output = & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\dumpbin.exe" /dependents target\x86_64-pc-windows-msvc\$BuildType\cosmian_findex_server.exe | Select-String "libcrypto"
if ($output) {
throw "OpenSSL (libcrypto) found in dynamic dependencies. Error: $output"
}

exit 0
}


# Example usage:
# BuildProject -BuildType debug
# BuildProject -BuildType release
6 changes: 4 additions & 2 deletions .github/scripts/cargo_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ fi
rustup target add "$TARGET"

# shellcheck disable=SC2086
cargo build --target $TARGET $RELEASE $FEATURES
cargo build --target $TARGET $RELEASE

export RUST_LOG="cosmian_findex_cli=debug,cosmian_findex_server=trace,test_findex_server=trace"

# shellcheck disable=SC2086
cargo test --target $TARGET $RELEASE --workspace -- --nocapture $SKIP_SERVICES_TESTS
cargo test --target $TARGET $RELEASE --workspace -- --nocapture $SKIP_SERVICES_TESTS --include-ignored
15 changes: 15 additions & 0 deletions .github/scripts/loop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -ex

cargo build --workspace --all-targets

# export RUST_LOG="cosmian_findex_cli=trace,cosmian_findex_server=trace,test_findex_server=trace"

echo "Running tests in an infinite loop"
while true; do
reset
# cargo test --workspace -- --nocapture
cargo nextest run --workspace --nocapture
sleep 1
done
13 changes: 11 additions & 2 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
archive-name: ${{ matrix.archive-name }}
target: ${{ matrix.target }}
debug_or_release: ${{ inputs.debug_or_release }}
skip_services_tests: --skip test_redis
skip_services_tests: --skip test_findex --skip test_all_authentications --skip test_server_auth_matrix --skip test_datasets

generic-macos:
strategy:
Expand All @@ -58,12 +58,21 @@ jobs:
archive-name: ${{ matrix.archive-name }}
target: ${{ matrix.target }}
debug_or_release: ${{ inputs.debug_or_release }}
skip_services_tests: --skip test_redis
skip_services_tests: --skip test_findex --skip test_all_authentications --skip test_server_auth_matrix --skip test_datasets

windows-2022:
# if: inputs.debug_or_release == 'release'
uses: ./.github/workflows/build_windows.yml
with:
toolchain: ${{ inputs.toolchain }}
archive-name: windows
debug_or_release: ${{ inputs.debug_or_release }}

cleanup:
needs:
- rhel9
- generic-linux
- generic-macos
- windows-2022
uses: Cosmian/reusable_workflows/.github/workflows/cleanup_cache.yml@develop
secrets: inherit
74 changes: 74 additions & 0 deletions .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
name: Docker build

on:
workflow_call:
inputs:
dockerfile:
required: true
type: string
registry-image:
required: true
type: string
platforms:
required: true
type: string

env:
REGISTRY: ghcr.io

jobs:
build-and-push-image:
name: Image
runs-on: ubuntu-22.04
container: docker:19.03.15

steps:
- name: Display cpuinfo
run: cat /proc/cpuinfo

- name: Install tar
run: apk add --no-cache tar

- uses: actions/checkout@v3

- name: Login to GitHub Packages
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ inputs.registry-image }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and tag docker container
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: ${{ inputs.platforms }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ${{ inputs.dockerfile }}
network: host

- name: Display metadata version ${{ steps.meta.outputs.version }}
run: |
echo version: "${{ steps.meta.outputs.version }}"
echo tags: "${{ steps.meta.outputs.tags }}"

outputs:
image-tag: ${{ inputs.registry-image }}:${{ steps.meta.outputs.version }}
36 changes: 35 additions & 1 deletion .github/workflows/build_generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,41 @@ jobs:
with:
name: ${{ inputs.archive-name }}-${{ inputs.debug_or_release }}
path: |
target/${{ inputs.target }}/${{ inputs.debug_or_release }}/cosmian_findex_cli
target/${{ inputs.target }}/${{ inputs.debug_or_release }}/cosmian_findex_server
target/${{ inputs.target }}/${{ inputs.debug_or_release }}/findex
retention-days: 1
if-no-files-found: error

test:
needs: cargo-build
name: Clean env. ${{ inputs.archive-name }}
runs-on: ${{ inputs.distribution }}
steps:
- uses: actions/download-artifact@v3
with:
name: ${{ inputs.archive-name }}-${{ inputs.debug_or_release }}

- run: find .
if: contains(runner.os, 'linux')

- name: Linux launch cli and server
if: contains(runner.os, 'Linux')
run: |
set -ex
pwd
find . -type f
chmod u+x ./cosmian_findex_cli
chmod u+x ./cosmian_findex_server

./cosmian_findex_cli -V
./cosmian_findex_server -V

- name: MacOS launch cli and server
if: contains(runner.os, 'macos')
run: |
set -ex
chmod u+x ./cosmian_findex_cli
chmod u+x ./cosmian_findex_server

./cosmian_findex_cli -V
./cosmian_findex_server -V
93 changes: 93 additions & 0 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
name: Findex server cargo build - windows

on:
workflow_call:
inputs:
toolchain:
required: true
type: string
archive-name:
required: true
type: string
debug_or_release:
required: true
type: string

jobs:
findex-server-build:
name: ${{ inputs.archive-name }}
runs-on: windows-2022
steps:
- name: Print ENV
run: printenv

- uses: actions/checkout@v3

- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ inputs.toolchain }}
components: rustfmt, clippy

# - name: Discover dumpbin location
# shell: pwsh
# run: |
# Get-ChildItem -Recurse "C:\Program Files\Microsoft Visual Studio"

- name: Discover environment variables on Runner
shell: pwsh
run: |
Get-ChildItem env:

- name: Locate VCPKG_INSTALLATION_ROOT
shell: pwsh
run: |
Get-ChildItem $env:VCPKG_INSTALLATION_ROOT

- name: Build static OpenSSL
shell: pwsh
run: |
vcpkg install --triplet x64-windows-static
vcpkg integrate install

Get-ChildItem -Recurse "$env:VCPKG_INSTALLATION_ROOT\packages"

- name: Build
shell: pwsh
run: |
. .\.github\scripts\cargo_build.ps1
BuildProject -BuildType ${{ inputs.debug_or_release }}
env:
# Google variables
TEST_GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.TEST_GOOGLE_OAUTH_CLIENT_ID }}
TEST_GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.TEST_GOOGLE_OAUTH_CLIENT_SECRET }}
TEST_GOOGLE_OAUTH_REFRESH_TOKEN: ${{ secrets.TEST_GOOGLE_OAUTH_REFRESH_TOKEN }}

- name: Upload Findex server for windows-2022
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.archive-name }}-${{ inputs.debug_or_release }}
path: |
target/x86_64-pc-windows-msvc/${{ inputs.debug_or_release }}/cosmian_findex_cli.exe
target/x86_64-pc-windows-msvc/${{ inputs.debug_or_release }}/cosmian_findex_server.exe
retention-days: 1
if-no-files-found: error

findex-server-test:
needs: findex-server-build
name: Clean env. ${{ inputs.archive-name }}
runs-on: windows-2022
steps:
- uses: actions/download-artifact@v3
with:
name: ${{ inputs.archive-name }}-${{ inputs.debug_or_release }}

- name: List files recursively
shell: pwsh
run: Get-ChildItem -Recurse

- name: Launch cosmian_findex_cli and cosmian_findex_server
run: |
pwd
./cosmian_findex_cli.exe -V
./cosmian_findex_server.exe -V
21 changes: 4 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
---
name: CI checks
name: CI debug

on:
push:

jobs:
cargo-audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1

cargo-lint:
uses: ./.github/workflows/clippy.yml
with:
toolchain: nightly-2024-06-09

build_tests:
uses: ./.github/workflows/build_all.yml
secrets: inherit
main:
uses: ./.github/workflows/main_base.yml
with:
toolchain: nightly-2024-06-09
toolchain: stable-2024-10-17
debug_or_release: debug
Loading
Loading