diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..4248e29 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "swashbuckle.aspnetcore.cli": { + "version": "6.6.1", + "commands": [ + "swagger" + ] + } + } +} diff --git a/Makefile b/Makefile index 1f5afee..f34be40 100644 --- a/Makefile +++ b/Makefile @@ -27,11 +27,11 @@ start-dev: build-dev ## Starts development environment clean-dev: ## Cleans development environment $(COMPOSE_APP_DEV) down --remove-orphans -update-api-reference: start-dev ## Updates OpenAPI schemas in docs site - @scripts/update-api-reference.sh +update-api-reference: ## Updates OpenAPI schemas in docs site + $(COMPOSE_TOOLING_RUN) scripts/update-api-reference.sh check-api-reference: start-dev ## Checks OpenAPI schemas are updated - @scripts/check-api-reference.sh + $(COMPOSE_TOOLING_RUN) scripts/check-api-reference.sh build-docs: ## Builds documentation site $(COMPOSE_RUN_DOCS) build --strict --clean diff --git a/compose.tooling.yaml b/compose.tooling.yaml index c70a376..c0e637c 100644 --- a/compose.tooling.yaml +++ b/compose.tooling.yaml @@ -3,3 +3,5 @@ services: build: context: . dockerfile: ./tooling.Dockerfile + volumes: + - .:/app diff --git a/scripts/check-api-reference.sh b/scripts/check-api-reference.sh index ce26726..cc45309 100755 --- a/scripts/check-api-reference.sh +++ b/scripts/check-api-reference.sh @@ -1,7 +1,9 @@ #!/bin/bash set -euo pipefail -diff -q docs/docs/api-reference/difficalcy-osu.json <(curl --silent localhost:5000/swagger/v1/swagger.json) -diff -q docs/docs/api-reference/difficalcy-taiko.json <(curl --silent localhost:5001/swagger/v1/swagger.json) -diff -q docs/docs/api-reference/difficalcy-catch.json <(curl --silent localhost:5002/swagger/v1/swagger.json) -diff -q docs/docs/api-reference/difficalcy-mania.json <(curl --silent localhost:5003/swagger/v1/swagger.json) +dotnet build + +diff -q docs/docs/api-reference/difficalcy-osu.json <(dotnet tool run swagger tofile Difficalcy.Osu/bin/Debug/net8.0/Difficalcy.Osu.dll v1) +diff -q docs/docs/api-reference/difficalcy-taiko.json <(dotnet tool run swagger tofile Difficalcy.Taiko/bin/Debug/net8.0/Difficalcy.Taiko.dll v1) +diff -q docs/docs/api-reference/difficalcy-catch.json <(dotnet tool run swagger tofile Difficalcy.Catch/bin/Debug/net8.0/Difficalcy.Catch.dll v1) +diff -q docs/docs/api-reference/difficalcy-mania.json <(dotnet tool run swagger tofile Difficalcy.Mania/bin/Debug/net8.0/Difficalcy.Mania.dll v1) diff --git a/scripts/update-api-reference.sh b/scripts/update-api-reference.sh index 490dd84..94515aa 100755 --- a/scripts/update-api-reference.sh +++ b/scripts/update-api-reference.sh @@ -1,7 +1,9 @@ #!/bin/bash set -euo pipefail -curl localhost:5000/swagger/v1/swagger.json -o docs/docs/api-reference/difficalcy-osu.json -curl localhost:5001/swagger/v1/swagger.json -o docs/docs/api-reference/difficalcy-taiko.json -curl localhost:5002/swagger/v1/swagger.json -o docs/docs/api-reference/difficalcy-catch.json -curl localhost:5003/swagger/v1/swagger.json -o docs/docs/api-reference/difficalcy-mania.json +dotnet build + +dotnet tool run swagger tofile Difficalcy.Osu/bin/Debug/net8.0/Difficalcy.Osu.dll v1 > docs/docs/api-reference/difficalcy-osu.json +dotnet tool run swagger tofile Difficalcy.Taiko/bin/Debug/net8.0/Difficalcy.Taiko.dll v1 > docs/docs/api-reference/difficalcy-taiko.json +dotnet tool run swagger tofile Difficalcy.Catch/bin/Debug/net8.0/Difficalcy.Catch.dll v1 > docs/docs/api-reference/difficalcy-catch.json +dotnet tool run swagger tofile Difficalcy.Mania/bin/Debug/net8.0/Difficalcy.Mania.dll v1 > docs/docs/api-reference/difficalcy-mania.json diff --git a/tooling.Dockerfile b/tooling.Dockerfile index d701c53..7f802df 100644 --- a/tooling.Dockerfile +++ b/tooling.Dockerfile @@ -8,6 +8,10 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | d WORKDIR /app +COPY .config/dotnet-tools.json ./.config/ + +RUN dotnet tool restore + COPY Difficalcy.sln . COPY Difficalcy/Difficalcy.csproj ./Difficalcy/ COPY Difficalcy.Catch/Difficalcy.Catch.csproj ./Difficalcy.Catch/