Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 13 additions & 1 deletion .github/actions/sandbox/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ inputs:
- html
- headless
- empty
edition:
description: edition
required: true
type: choice
options:
- community
- enterprise
port:
description: Port
required: true
Expand All @@ -20,31 +27,36 @@ runs:
shell: bash
env:
SANDBOX_CONFIGURATION: ${{ inputs.configuration }}
SANDBOX_EDITION: ${{ inputs.edition }}
SANDBOX_PORT: ${{ inputs.port }}
PARALLEL: 2
- name: Up Sandbox (${{ inputs.configuration }})
run: make docker-sandbox-up
shell: bash
env:
SANDBOX_CONFIGURATION: ${{ inputs.configuration }}
SANDBOX_EDITION: ${{ inputs.edition }}
SANDBOX_PORT: ${{ inputs.port }}
- name: Test Sandbox - E2E (${{ inputs.configuration }})
run: make test-e2e PRESET=Release
shell: bash
env:
SANDBOX_CONFIGURATION: ${{ inputs.configuration }}
SANDBOX_EDITION: ${{ inputs.edition }}
SANDBOX_PORT: ${{ inputs.port }}
HURL: 'docker run --rm --network=host --volume \$(PWD):/workspace --workdir /workspace ghcr.io/orange-opensource/hurl:7.0.0'
- name: Test Sandbox - UI (${{ inputs.configuration }})
run: make test-ui PRESET=Release
if: inputs.configuration == 'html'
if: inputs.configuration == 'html' && inputs.edition == 'enterprise'
shell: bash
env:
SANDBOX_CONFIGURATION: ${{ inputs.configuration }}
SANDBOX_EDITION: ${{ inputs.edition }}
SANDBOX_PORT: ${{ inputs.port }}
- name: Down Sandbox (${{ inputs.configuration }})
run: make docker-sandbox-down
shell: bash
env:
SANDBOX_CONFIGURATION: ${{ inputs.configuration }}
SANDBOX_EDITION: ${{ inputs.edition }}
SANDBOX_PORT: ${{ inputs.port }}
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,46 @@ jobs:
- run: codespell docs *.markdown docs/*.md

test:
strategy:
fail-fast: false
matrix:
edition:
- name: community
enterprise: OFF
- name: enterprise
enterprise: ON

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build One
run: make docker PRESET=Release
run: make docker PRESET=Release ENTERPRISE=${{ matrix.edition.enterprise }}

- name: Sandbox (headless)
uses: ./.github/actions/sandbox
with:
configuration: headless
edition: ${{ matrix.edition.name }}
port: 8000

- name: Sandbox (html)
uses: ./.github/actions/sandbox
with:
configuration: html
edition: ${{ matrix.edition.name }}
port: 8000

- name: Sandbox (empty)
uses: ./.github/actions/sandbox
with:
configuration: empty
edition: ${{ matrix.edition.name }}
port: 8000

# Public instance
- run: docker build . --file public/Dockerfile --progress plain
if: matrix.edition.name == 'enterprise'

website:
runs-on: ubuntu-latest
Expand Down
22 changes: 19 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ if(NOT ONE_PREFIX_IS_ABSOLUTE)
message(FATAL_ERROR "ONE_PREFIX must be an absolute path but it was: ${ONE_PREFIX}")
endif()

# Commercial editions require a paid license
# See https://one.sourcemeta.com/commercial/
option(ONE_ENTERPRISE "Build the One Enterprise edition (commercial license required)" OFF)
if(ONE_ENTERPRISE)
message(STATUS "Sourcemeta One edition: Enterprise")
else()
message(STATUS "Sourcemeta One edition: Community")
endif()

find_package(Core REQUIRED)
find_package(Blaze REQUIRED)
find_package(Codegen REQUIRED)
Expand Down Expand Up @@ -61,11 +70,14 @@ if(ONE_INDEX)
include(commands/esbuild)
add_subdirectory(src/configuration)
add_subdirectory(src/resolver)
add_subdirectory(src/web)
add_subdirectory(src/index)
add_subdirectory(collections)
add_dependencies(sourcemeta_one_index
sourcemeta_one_collections)

if(ONE_ENTERPRISE)
add_subdirectory(enterprise/src/web)
endif()
endif()

if(ONE_SERVER)
Expand All @@ -90,11 +102,15 @@ add_custom_target(jsonschema_lint

if(ONE_TESTS)
enable_testing()

add_test(NAME one.schemas COMMAND
"$<TARGET_FILE:jsonschema_cli>" test --extension .test.json
"${PROJECT_SOURCE_DIR}/collections/sourcemeta")
"${PROJECT_SOURCE_DIR}/collections"
"${PROJECT_SOURCE_DIR}/enterprise/collections")

add_subdirectory(test/js)
if(ONE_ENTERPRISE)
add_subdirectory(enterprise/test/js)
endif()

if(ONE_INDEX OR ONE_SERVER)
add_subdirectory(test/unit/gzip)
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ COPY contrib /source/contrib
COPY collections /source/collections
COPY vendor /source/vendor
COPY CMakeLists.txt /source/CMakeLists.txt
COPY enterprise /source/enterprise

# For testing
COPY test/cli /source/test/cli
COPY test/unit /source/test/unit
COPY test/js /source/test/js

RUN cd /source && npm ci

# Commercial editions require a paid license
# See https://one.sourcemeta.com/commercial/
ARG SOURCEMETA_ONE_ENTERPRISE=OFF

ARG SOURCEMETA_ONE_BUILD_TYPE=Release
ARG SOURCEMETA_ONE_PARALLEL=2

Expand All @@ -32,6 +36,7 @@ RUN cmake -S /source -B ./build \
-DONE_INDEX:BOOL=ON \
-DONE_SERVER:BOOL=ON \
-DONE_TESTS:BOOL=ON \
-DONE_ENTERPRISE:BOOL=${SOURCEMETA_ONE_ENTERPRISE} \
-DBUILD_SHARED_LIBS:BOOL=OFF

RUN cmake --build /build \
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ SANDBOX_PORT ?= 8000
SANDBOX_URL ?= http://localhost:$(SANDBOX_PORT)
PUBLIC ?= ./public
PARALLEL ?= 4
# Only for local development
ENTERPRISE ?= ON

.PHONY: all
all: configure compile test
Expand All @@ -37,6 +39,7 @@ configure: node_modules
-DONE_INDEX:BOOL=$(INDEX) \
-DONE_SERVER:BOOL=$(SERVER) \
-DONE_PREFIX:STRING=$(or $(realpath $(PREFIX)),$(abspath $(PREFIX))) \
-DONE_ENTERPRISE:BOOL=$(ENTERPRISE) \
-DBUILD_SHARED_LIBS:BOOL=OFF

.PHONY: compile
Expand Down Expand Up @@ -68,11 +71,13 @@ endif
test-e2e:
$(HURL) --test --variable base=$(SANDBOX_URL) $(HURL_TESTS)

ifeq ($(ENTERPRISE),ON)
.PHONY: test-ui
test-ui: node_modules
$(NPX) playwright install --with-deps
env PLAYWRIGHT_BASE_URL=$(SANDBOX_URL) \
$(NPX) playwright test --config test/ui/playwright.config.js
$(NPX) playwright test --config enterprise/test/ui/playwright.config.js
endif

.PHONY: sandbox-index
sandbox-index: compile
Expand All @@ -97,7 +102,8 @@ sandbox-manifest-refresh: configure compile
docker: Dockerfile
$(DOCKER) build --tag one . --file $< --progress plain \
--build-arg SOURCEMETA_ONE_BUILD_TYPE=$(PRESET) \
--build-arg SOURCEMETA_ONE_PARALLEL=$(PARALLEL)
--build-arg SOURCEMETA_ONE_PARALLEL=$(PARALLEL) \
--build-arg SOURCEMETA_ONE_ENTERPRISE=$(ENTERPRISE)

.PHONY: docker-sandbox-build
docker-sandbox-build: test/sandbox/compose.yaml
Expand Down
5 changes: 4 additions & 1 deletion collections/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
set(ONE_COLLECTION_SOURCES)

include("./sourcemeta/std/v0/one.cmake")
if(ONE_ENTERPRISE)
include("../enterprise/collections/sourcemeta/std/v0/one.cmake")
endif()

include("./self/v1/one.cmake")

add_custom_target(sourcemeta_one_collections DEPENDS ${ONE_COLLECTION_SOURCES})
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
},
{
"description": "Self top-level entry",
"valid": false,
"valid": true,
"data": {
"url": "http://localhost:8000",
"html": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
69 changes: 69 additions & 0 deletions enterprise/src/web/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* All rights reserved. You can only use this software
* under a commercial license, as set out in
* <https://www.sourcemeta.com/licensing/>.
*/

@import "../../../vendor/bootstrap/scss/functions";

$border-radius: 0;
$breadcrumb-font-size: 15px;

@import "../../../vendor/bootstrap/scss/variables";
@import "../../../vendor/bootstrap/scss/variables-dark";
@import "../../../vendor/bootstrap/scss/maps";
@import "../../../vendor/bootstrap/scss/mixins";
@import "../../../vendor/bootstrap/scss/utilities";

@import "../../../vendor/bootstrap/scss/root";
@import "../../../vendor/bootstrap/scss/reboot";
@import "../../../vendor/bootstrap/scss/type";
@import "../../../vendor/bootstrap/scss/images";
@import "../../../vendor/bootstrap/scss/containers";
@import "../../../vendor/bootstrap/scss/grid";

@import "../../../vendor/bootstrap/scss/tables";
@import "../../../vendor/bootstrap/scss/forms";
@import "../../../vendor/bootstrap/scss/buttons";
// @import "../../../vendor/bootstrap/scss/transitions";
// @import "../../../vendor/bootstrap/scss/dropdown";
@import "../../../vendor/bootstrap/scss/button-group";
@import "../../../vendor/bootstrap/scss/nav";
@import "../../../vendor/bootstrap/scss/navbar";
// @import "../../../vendor/bootstrap/scss/card";
// @import "../../../vendor/bootstrap/scss/accordion";
@import "../../../vendor/bootstrap/scss/breadcrumb";
// @import "../../../vendor/bootstrap/scss/pagination";
@import "../../../vendor/bootstrap/scss/badge";
@import "../../../vendor/bootstrap/scss/alert";
@import "../../../vendor/bootstrap/scss/progress";
@import "../../../vendor/bootstrap/scss/list-group";
// @import "../../../vendor/bootstrap/scss/close";
// @import "../../../vendor/bootstrap/scss/toasts";
// @import "../../../vendor/bootstrap/scss/modal";
// @import "../../../vendor/bootstrap/scss/tooltip";
// @import "../../../vendor/bootstrap/scss/popover";
// @import "../../../vendor/bootstrap/scss/carousel";
// @import "../../../vendor/bootstrap/scss/spinners";
// @import "../../../vendor/bootstrap/scss/offcanvas";
// @import "../../../vendor/bootstrap/scss/placeholders";

@import "../../../vendor/bootstrap/scss/helpers";
@import "../../../vendor/bootstrap/scss/utilities/api";

// Bootstrap Icons
$bootstrap-icons-font: bootstrap-icons;
$bootstrap-icons-font-dir: "/self/static";
@import "../../../vendor/bootstrap-icons/font/bootstrap-icons.scss";

// Bootstrap doesn't seem to provide breakpoint-based modifiers to `.w-*`
@include media-breakpoint-up(md) {
.w-md-auto {
width: auto !important;
}
}

// Tables with vertical headers collapse the headers by default
table tr > th[scope="row"] {
width: 1px;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'list',
outputDir: '../../build/test-results',
outputDir: '../../../build/test-results',
use: {
baseURL: process.env.PLAYWRIGHT_BASE_URL,
trace: 'on-first-retry'
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion src/index/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ target_compile_definitions(sourcemeta_one_index
target_link_libraries(sourcemeta_one_index PRIVATE sourcemeta::one::resolver)
target_link_libraries(sourcemeta_one_index PRIVATE sourcemeta::one::shared)
target_link_libraries(sourcemeta_one_index PRIVATE sourcemeta::one::configuration)
target_link_libraries(sourcemeta_one_index PRIVATE sourcemeta::one::web)

if(ONE_ENTERPRISE)
target_link_libraries(sourcemeta_one_index PRIVATE sourcemeta::one::web)
target_compile_definitions(sourcemeta_one_index PRIVATE SOURCEMETA_ONE_ENTERPRISE)
endif()

target_link_libraries(sourcemeta_one_index PRIVATE sourcemeta::core::build)
target_link_libraries(sourcemeta_one_index PRIVATE sourcemeta::core::uri)
Expand Down
10 changes: 10 additions & 0 deletions src/index/index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
#include <sourcemeta/one/configuration.h>
#include <sourcemeta/one/resolver.h>
#include <sourcemeta/one/shared.h>

#if defined(SOURCEMETA_ONE_ENTERPRISE)
#include <sourcemeta/one/web.h>
#endif

#include "explorer.h"
#include "generators.h"
Expand Down Expand Up @@ -437,6 +440,8 @@ static auto index_main(const std::string_view &program,
/////////////////////////////////////////////////////////////////////////////

if (configuration.html.has_value()) {
#if defined(SOURCEMETA_ONE_ENTERPRISE)
// TODO: Abstract all of this in enterprise/src/web
sourcemeta::core::parallel_for_each(
directories.begin(), directories.end(),
[&configuration, &output, &schemas_path, &explorer_path, &directories,
Expand Down Expand Up @@ -501,6 +506,11 @@ static auto index_main(const std::string_view &program,
"schema", adapter, output);
},
concurrency);
#else
std::cerr
<< "The `html` option is only available on the Enterprise edition\n";
return EXIT_FAILURE;
#endif
}

/////////////////////////////////////////////////////////////////////////////
Expand Down
Loading
Loading