Skip to content

Commit

Permalink
Fix running sandbox locally (#36)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti authored Nov 13, 2024
1 parent ab1e087 commit b7715de
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ jobs:
HURL_VERSION: 5.0.1

# Linting
- run: make configure PRESET=Release INDEX=OFF SERVER=OFF
- run: make lint PRESET=Release
- run: make configure PRESET=Release INDEX=OFF SERVER=OFF EDITION=${{ matrix.edition.suffix }}
- run: make lint PRESET=Release EDITION=${{ matrix.edition.suffix }}

# Testing
- run: make test-schemas PRESET=Release
- run: make test-schemas PRESET=Release EDITION=${{ matrix.edition.suffix }}
- run: docker build --tag registry-${{ matrix.edition.suffix }} . --file Dockerfile.${{ matrix.edition.suffix }} --progress plain
- run: docker compose --file test/sandbox/compose-${{ matrix.edition.suffix }}.yaml build
- run: docker compose --file test/sandbox/compose-${{ matrix.edition.suffix }}.yaml up --detach --wait
- run: make test-e2e-common PRESET=Release
- run: make test-e2e-${{ matrix.edition.suffix }} PRESET=Release
- run: make test-e2e PRESET=Release EDITION=${{ matrix.edition.suffix }}
- run: docker compose --file test/sandbox/compose-${{ matrix.edition.suffix }}.yaml down
2 changes: 1 addition & 1 deletion Dockerfile.ce
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN cmake --build /build --config Release --parallel 2
RUN cmake --install ./build --prefix /usr --verbose \
--config Release --component sourcemeta_registry

RUN make -C /source test PREFIX=/usr ENTERPRISE=OFF
RUN make -C /source test PREFIX=/usr EDITION=ce

FROM debian:bookworm-slim
COPY --from=builder /usr/bin/sourcemeta-registry-index \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ee
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN cmake --build /build --config Release --parallel 2
RUN cmake --install ./build --prefix /usr --verbose \
--config Release --component sourcemeta_registry

RUN make -C /source test PREFIX=/usr ENTERPRISE=ON
RUN make -C /source test PREFIX=/usr EDITION=ee

FROM debian:bookworm-slim
COPY --from=builder /usr/bin/sourcemeta-registry-index \
Expand Down
24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ DOCKER ?= docker
# Options
INDEX ?= ON
SERVER ?= ON
ENTERPRISE ?= ON
EDITION ?= ee
PRESET ?= Debug
OUTPUT ?= ./build
PREFIX ?= $(OUTPUT)/dist
SANDBOX ?= ./test/sandbox

ifeq ($(EDITION), ee)
ENTERPRISE := ON
else
ENTERPRISE := OFF
endif

.PHONY: all
all: configure compile test-schemas test

Expand Down Expand Up @@ -60,26 +66,22 @@ endif
test-schemas:
$(JSONSCHEMA) test test/schemas --resolve schemas

test-e2e-%:
.PHONY: test-e2e
test-e2e:
$(HURL) --test \
--variable base=$(shell jq --raw-output '.url' < $(SANDBOX)/configuration.json) \
test/e2e/$(subst test-e2e-,,$@)/*.hurl
test/e2e/common/*.hurl test/e2e/$(EDITION)/*.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
./test/sandbox/manifest-check.sh $(OUTPUT)/sandbox $(SANDBOX)/manifest-$(EDITION).txt
$(PREFIX)/bin/sourcemeta-registry-server $(OUTPUT)/sandbox

.PHONY: docker
docker:
ifeq ($(ENTERPRISE), ON)
$(DOCKER) build --tag registry . --file Dockerfile.ee --progress plain
$(DOCKER) compose --file test/sandbox/compose-ee.yaml up --build
else
$(DOCKER) build --tag registry . --file Dockerfile.ce --progress plain
$(DOCKER) compose --file test/sandbox/compose-ce.yaml up --build
endif
$(DOCKER) build --tag registry-$(EDITION) . --file Dockerfile.$(EDITION) --progress plain
$(DOCKER) compose --file test/sandbox/compose-$(EDITION).yaml up --build

.PHONY: clean
clean:
Expand Down

0 comments on commit b7715de

Please sign in to comment.