Skip to content

Commit 4d3d955

Browse files
committed
Add multi-part up and downloads
1 parent d1da83a commit 4d3d955

19 files changed

+1790
-313
lines changed

.github/workflows/ci.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright (c) 2021-2022-2023 Luca Cappa
2+
# Released under the term specified in file LICENSE.txt
3+
# SPDX short identifier: MIT
4+
#
5+
# The peculiarity of this workflow is that assumes vcpkg stored as a submodule of this repository.
6+
# The workflow runs on x64 and ARM platforms.
7+
# Workflow steps:
8+
# - Setup vcpkg and cache it on the GitHub Action cloud based cache.
9+
# - Runs CMake with CMakePreset.json using a presest configuration
10+
# that leverages the vcpkg's toolchain file. This will automatically run vcpkg
11+
# to install dependencies described by the vcpkg.json manifest file.
12+
# This stage also runs vcpkg with Binary Caching leveraging GitHub Action cache to
13+
# store the built packages artifacts, hence it will be a no-op if those are restored
14+
# from cache (e.g., already previously built).
15+
# - Finally builds the sources with Ninja, and tests as well.
16+
name: ci
17+
on:
18+
push:
19+
pull_request:
20+
21+
jobs:
22+
job:
23+
name: ${{ matrix.os }}-${{ github.workflow }}
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
os: [ubuntu-latest, macos-latest, windows-latest, buildjet-2vcpu-ubuntu-2204-arm]
29+
#env:
30+
#
31+
# [OPTIONAL] Define the vcpkg's triplet
32+
# you want to enforce, otherwise the default one
33+
# for the hosting system will be automatically
34+
# choosen (x64 is the default on all platforms,
35+
# e.g. x64-osx).
36+
# VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
37+
38+
steps:
39+
- uses: actions/checkout@v3
40+
with:
41+
submodules: true
42+
43+
- uses: lukka/get-cmake@latest
44+
45+
- name: Restore from cache and setup vcpkg executable and data files.
46+
uses: lukka/run-vcpkg@v11
47+
with:
48+
vcpkgJsonGlob: 'vcpkg.json'
49+
50+
# Note: if the preset misses the "configuration", it is possible to explicitly select the
51+
# configuration with the additional `--config` flag, e.g.:
52+
# buildPreset: 'ninja-vcpkg'
53+
# buildPresetAdditionalArgs: "[`--config`, `Release`]"
54+
# testPreset: 'ninja-vcpkg'
55+
# testPresetAdditionalArgs: "[`--config`, `Release`]"
56+
- name: Run CMake+vcpkg+Ninja+CTest to build packages and generate/build/test the code.
57+
uses: lukka/run-cmake@v10
58+
with:
59+
configurePreset: 'ninja-multi-vcpkg'
60+
buildPreset: 'ninja-vcpkg-release'
61+
testPreset: 'test-release'
62+
63+
- name: Set up Python 3.11
64+
uses: actions/setup-python@v4
65+
with:
66+
python-version: 3.11
67+
68+
- name: Install Python dependencies
69+
run: pip install -r test/requirements.txt
70+
71+
- name: Install pytest dependencies
72+
run: pip install pytest-md pytest-emoji
73+
74+
- uses: pavelzw/pytest-action@v2
75+
with:
76+
custom-arguments: -p no:sugar

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ test/requirements.txt
77
test/.test_venv
88
.vscode/settings.json
99
__pycache__
10+
test/.venv/*
11+
builds
12+
vcpkg

CMakeLists.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.15)
1+
cmake_minimum_required(VERSION 3.21)
22
project(hs5 VERSION 0.1.0 LANGUAGES CXX C)
33

44
add_executable(hs5
@@ -10,7 +10,8 @@ add_executable(hs5
1010
SingleFileStorage.cpp
1111
data.cpp
1212
os_functions.cpp
13-
utils.cpp )
13+
utils.cpp
14+
crypt.cpp )
1415

1516
#set(GCC_COVERAGE_COMPILE_FLAGS "-fcoroutines")
1617

@@ -19,7 +20,9 @@ add_definitions(${GCC_COVERAGE_COMPILE_FLAGS})
1920
find_package(folly CONFIG REQUIRED)
2021
find_package(proxygen CONFIG REQUIRED)
2122
find_package(zstd CONFIG REQUIRED)
22-
target_link_libraries(hs5 PRIVATE $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static> Folly::folly Folly::folly_deps Folly::follybenchmark Folly::folly_test_util proxygen::proxygen proxygen::proxygencurl proxygen::proxygenhttpserver)
23+
find_package(expat CONFIG REQUIRED)
24+
find_package(unofficial-sodium CONFIG REQUIRED)
25+
target_link_libraries(hs5 PRIVATE $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static> Folly::folly Folly::folly_deps Folly::follybenchmark Folly::folly_test_util proxygen::proxygen proxygen::proxygencurl proxygen::proxygenhttpserver expat::expat unofficial-sodium::sodium unofficial-sodium::sodium_config_public)
2326

2427

2528
target_compile_features(hs5 PUBLIC cxx_std_20)

CMakePresets.json

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"version": 3,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 21,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "ninja-multi-vcpkg",
11+
"displayName": "Ninja Multi-Config",
12+
"description": "Configure with vcpkg toolchain and generate Ninja project files for all configurations",
13+
"binaryDir": "${sourceDir}/builds/${presetName}",
14+
"generator": "Ninja Multi-Config",
15+
"cacheVariables": {
16+
"CMAKE_TOOLCHAIN_FILE": {
17+
"type": "FILEPATH",
18+
"value": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
19+
}
20+
}
21+
}
22+
],
23+
"buildPresets": [
24+
{
25+
"name": "ninja-vcpkg-debug",
26+
"configurePreset": "ninja-multi-vcpkg",
27+
"displayName": "Build (Debug)",
28+
"description": "Build with Ninja/vcpkg (Debug)",
29+
"configuration": "Debug"
30+
},
31+
{
32+
"name": "ninja-vcpkg-release",
33+
"configurePreset": "ninja-multi-vcpkg",
34+
"displayName": "Build (Release)",
35+
"description": "Build with Ninja/vcpkg (Release)",
36+
"configuration": "Release"
37+
},
38+
{
39+
"name": "ninja-vcpkg",
40+
"configurePreset": "ninja-multi-vcpkg",
41+
"displayName": "Build",
42+
"description": "Build with Ninja/vcpkg"
43+
}
44+
],
45+
"testPresets": [
46+
{
47+
"name": "test-ninja-vcpkg",
48+
"configurePreset": "ninja-multi-vcpkg",
49+
"hidden": true
50+
},
51+
{
52+
"name": "test-debug",
53+
"description": "Test (Debug)",
54+
"displayName": "Test (Debug)",
55+
"configuration": "Debug",
56+
"inherits": [
57+
"test-ninja-vcpkg"
58+
]
59+
},
60+
{
61+
"name": "test-release",
62+
"description": "Test (Release)",
63+
"displayName": "Test (Release)",
64+
"configuration": "Release",
65+
"inherits": [
66+
"test-ninja-vcpkg"
67+
]
68+
}
69+
]
70+
}

0 commit comments

Comments
 (0)