-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Juan Cruz Viotti <[email protected]>
- Loading branch information
0 parents
commit 2300e66
Showing
1,074 changed files
with
339,384 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--ignore-dir=build | ||
--ignore-dir=vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor/** linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Sourcemeta Registry CI | ||
|
||
on: | ||
pull_request: | ||
|
||
concurrency: | ||
group: registry-ci-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# Dependencies | ||
- run: pipx install clang-format==19.1.0 | ||
- uses: intelligence-ai/[email protected] | ||
- name: Install Hurl | ||
run: | | ||
curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/${{ env.HURL_VERSION }}/hurl_${{ env.HURL_VERSION }}_amd64.deb | ||
sudo apt install ./hurl_${{ env.HURL_VERSION }}_amd64.deb | ||
rm hurl_${{ env.HURL_VERSION }}_amd64.deb | ||
env: | ||
HURL_VERSION: 5.0.1 | ||
|
||
# Linting | ||
- run: make configure PRESET=Release INDEX=OFF SERVER=OFF | ||
- run: make lint PRESET=Release | ||
|
||
# Testing | ||
- run: docker build --tag registry . --progress plain | ||
- run: docker compose build | ||
- run: docker compose up --detach --wait | ||
- run: make test PRESET=Release | ||
- run: docker compose down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CMakeLists.txt.user | ||
CMakeCache.txt | ||
CMakeFiles | ||
CMakeScripts | ||
Testing | ||
cmake_install.cmake | ||
install_manifest.txt | ||
compile_commands.json | ||
CTestTestfile.cmake | ||
_deps | ||
/build | ||
Brewfile.lock.json | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
brew "cmake" | ||
brew "hurl" | ||
brew "jq" | ||
tap "sourcemeta/apps" | ||
cask "sourcemeta/apps/jsonschema" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
project(registry VERSION 0.0.1 LANGUAGES CXX) | ||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") | ||
include(vendor/noa/cmake/noa.cmake) | ||
|
||
# Options | ||
option(REGISTRY_DEVELOPMENT "Build the Registry in development mode" OFF) | ||
option(REGISTRY_SERVER "Build the Registry server" ON) | ||
option(REGISTRY_INDEX "Build the Registry index tool" ON) | ||
|
||
find_package(JSONToolkit REQUIRED) | ||
find_package(Blaze REQUIRED) | ||
find_package(Hydra REQUIRED) | ||
|
||
# Always optimize the current architecture | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native") | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mtune=native") | ||
|
||
if(REGISTRY_INDEX) | ||
add_subdirectory(src/index) | ||
endif() | ||
|
||
if(REGISTRY_SERVER) | ||
add_subdirectory(src/server) | ||
endif() | ||
|
||
if(REGISTRY_DEVELOPMENT) | ||
noa_target_clang_format(SOURCES src/*.h src/*.cc) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
vendorpull https://github.com/sourcemeta/vendorpull dea311b5bfb53b6926a4140267959ae334d3ecf4 | ||
noa https://github.com/sourcemeta/noa caad2e1ceedf9fd1a18686a6a6d1e2b9757ead75 | ||
jsontoolkit https://github.com/sourcemeta/jsontoolkit c6d056cc608bf98705ad7700c8c891e1cf6865a0 | ||
blaze https://github.com/sourcemeta/blaze 970e8aef78f0140551dde12e0784b30595580f49 | ||
hydra https://github.com/sourcemeta/hydra 8c266c752192bfe40484436c1874a9795c637633 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM debian:bookworm AS builder | ||
RUN apt-get --yes update && apt-get install --yes --no-install-recommends \ | ||
build-essential cmake && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY cmake /source/cmake | ||
COPY src /source/src | ||
COPY schemas /source/schemas | ||
COPY vendor /source/vendor | ||
COPY CMakeLists.txt /source/CMakeLists.txt | ||
|
||
RUN cmake -S /source -B ./build \ | ||
-DCMAKE_BUILD_TYPE:STRING=Release \ | ||
-DREGISTRY_INDEX:BOOL=ON \ | ||
-DREGISTRY_SERVER:BOOL=ON \ | ||
-DREGISTRY_DEVELOPMENT:BOOL=OFF \ | ||
-DBUILD_SHARED_LIBS:BOOL=OFF | ||
|
||
RUN cmake --build /build --config Release --parallel 2 | ||
RUN cmake --install ./build --prefix /usr --verbose \ | ||
--config Release --component sourcemeta_registry | ||
|
||
FROM debian:bookworm-slim | ||
RUN apt-get --yes update && apt-get install --yes --no-install-recommends \ | ||
ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
COPY --from=builder /usr/bin/sourcemeta-registry-index \ | ||
/usr/bin/sourcemeta-registry-index | ||
COPY --from=builder /usr/bin/sourcemeta-registry-server \ | ||
/usr/bin/sourcemeta-registry-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
All rights reserved. You can only use this software under a commercial license, | ||
as set out in <https://www.sourcemeta.com/licensing/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Programs | ||
CMAKE ?= cmake | ||
HURL ?= hurl | ||
JSONSCHEMA ?= jsonschema | ||
DOCKER ?= docker | ||
|
||
# Options | ||
INDEX ?= ON | ||
SERVER ?= ON | ||
PRESET ?= Debug | ||
OUTPUT ?= ./build | ||
PREFIX ?= $(OUTPUT)/dist | ||
SANDBOX ?= ./test/sandbox | ||
|
||
.PHONY: all | ||
all: configure compile | ||
|
||
.PHONY: configure | ||
configure: | ||
$(CMAKE) -S . -B $(OUTPUT) \ | ||
-DCMAKE_BUILD_TYPE:STRING=$(PRESET) \ | ||
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON \ | ||
-DREGISTRY_DEVELOPMENT:BOOL=ON \ | ||
-DREGISTRY_INDEX:BOOL=$(INDEX) \ | ||
-DREGISTRY_SERVER:BOOL=$(SERVER) \ | ||
-DBUILD_SHARED_LIBS:BOOL=OFF | ||
|
||
.PHONY: compile | ||
compile: | ||
$(JSONSCHEMA) fmt --verbose schemas/*.json | ||
$(JSONSCHEMA) lint --verbose schemas/*.json | ||
$(CMAKE) --build $(OUTPUT) --config $(PRESET) --target clang_format | ||
$(CMAKE) --build $(OUTPUT) --config $(PRESET) --parallel 4 | ||
$(CMAKE) --install $(OUTPUT) --prefix $(PREFIX) --config $(PRESET) --verbose \ | ||
--component sourcemeta_registry | ||
|
||
.PHONY: lint | ||
lint: | ||
$(JSONSCHEMA) fmt --check --verbose schemas/*.json | ||
$(JSONSCHEMA) lint --verbose schemas/*.json | ||
$(CMAKE) --build $(OUTPUT) --config $(PRESET) --target clang_format | ||
|
||
.PHONY: test | ||
test: | ||
$(HURL) --test \ | ||
--variable base=$(shell jq --raw-output '.url' < $(SANDBOX)/configuration.json) \ | ||
test/e2e/*.hurl | ||
|
||
.PHONY: sandbox | ||
sandbox: compile | ||
$(PREFIX)/bin/sourcemeta-registry-index $(SANDBOX)/configuration.json $(OUTPUT)/sandbox | ||
./test/sandbox/manifest-check.sh $(OUTPUT)/sandbox $(SANDBOX)/manifest.txt | ||
$(PREFIX)/bin/sourcemeta-registry-server $(OUTPUT)/sandbox | ||
|
||
.PHONY: docker | ||
docker: | ||
$(DOCKER) build --tag registry . --progress plain | ||
$(DOCKER) compose up --build | ||
|
||
.PHONY: clean | ||
clean: | ||
$(CMAKE) -E rm -R -f build | ||
$(DOCKER) system prune --force --all --volumes || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if(NOT Blaze_FOUND) | ||
set(BLAZE_INSTALL OFF CACHE BOOL "disable installation") | ||
add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/blaze") | ||
set(Blaze_FOUND ON) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
if(NOT Hydra_FOUND) | ||
set(HYDRA_INSTALL OFF CACHE BOOL "disable installation") | ||
set(HYDRA_BUCKET OFF CACHE BOOL "disable S3 bucket support") | ||
add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/hydra") | ||
set(Hydra_FOUND ON) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if(NOT JSONToolkit_FOUND) | ||
set(JSONTOOLKIT_INSTALL OFF CACHE BOOL "disable installation") | ||
add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/jsontoolkit") | ||
set(JSONToolkit_FOUND ON) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
services: | ||
sandbox: | ||
build: | ||
context: test/sandbox | ||
ports: | ||
- 8000:8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"required": [ | ||
"url", | ||
"port", | ||
"collections" | ||
], | ||
"properties": { | ||
"collections": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "object", | ||
"required": [ | ||
"base", | ||
"path" | ||
], | ||
"properties": { | ||
"base": { | ||
"type": "string", | ||
"format": "url" | ||
}, | ||
"path": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"port": { | ||
"type": "integer", | ||
"minimum": 0 | ||
}, | ||
"url": { | ||
"type": "string", | ||
"format": "url" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
add_executable(schema_registry_index index.cc configure.h.in) | ||
|
||
noa_add_default_options(PRIVATE schema_registry_index) | ||
set_target_properties(schema_registry_index PROPERTIES OUTPUT_NAME sourcemeta-registry-index) | ||
target_link_libraries(schema_registry_index PRIVATE sourcemeta::jsontoolkit::uri) | ||
target_link_libraries(schema_registry_index PRIVATE sourcemeta::jsontoolkit::json) | ||
target_link_libraries(schema_registry_index PRIVATE sourcemeta::jsontoolkit::jsonschema) | ||
target_link_libraries(schema_registry_index PRIVATE sourcemeta::blaze::compiler) | ||
target_link_libraries(schema_registry_index PRIVATE sourcemeta::blaze::evaluator) | ||
|
||
file(READ "${PROJECT_SOURCE_DIR}/schemas/configuration.json" SCHEMA_CONFIGURATION) | ||
configure_file(configure.h.in configure.h @ONLY) | ||
target_include_directories(schema_registry_index PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") | ||
|
||
include(GNUInstallDirs) | ||
install(TARGETS schema_registry_index | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | ||
COMPONENT sourcemeta_registry) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef SOURCEMETA_REGISTRY_INDEX_CONFIGURE_H_ | ||
#define SOURCEMETA_REGISTRY_INDEX_CONFIGURE_H_ | ||
|
||
#include <string_view> // std::string_view | ||
|
||
namespace sourcemeta::registry { | ||
constexpr std::string_view PROJECT_VERSION{"@PROJECT_VERSION@"}; | ||
constexpr std::string_view SCHEMA_CONFIGURATION{R"EOF(@SCHEMA_CONFIGURATION@)EOF"}; | ||
} | ||
|
||
#endif |
Oops, something went wrong.