Skip to content

Commit

Permalink
swagger_json
Browse files Browse the repository at this point in the history
  • Loading branch information
epompeii committed Nov 17, 2023
1 parent 519c731 commit 90160be
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 37 deletions.
3 changes: 0 additions & 3 deletions .dockerignore

This file was deleted.

6 changes: 2 additions & 4 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@

KIND=${1:-local}

cd docker
docker compose -f builder.docker-compose.yml build
docker compose -f $KIND.docker-compose.yml up --build
cd -
docker compose -f docker/builder.docker-compose.yml build
docker compose -f docker/$KIND.docker-compose.yml up --build
2 changes: 1 addition & 1 deletion lib/bencher_client/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(let_underscore_drop, clippy::unwrap_used)]

fn main() {
let src = "../../services/console/src/content/api/swagger.json";
let src = "../bencher_valid/swagger.json";
println!("cargo:rerun-if-changed={src}");
let file = std::fs::File::open(src).unwrap();
let spec = serde_json::from_reader(file).unwrap();
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ cd -

git add Cargo.toml
git add Cargo.lock
git add ./lib/bencher_valid/swagger.json
git add ./services/action/dist/index.js
git add ./services/console/package.json
git add ./services/console/package-lock.json
git add ./services/console/src/content/api/swagger.json
git add ./services/console/src/content/reference/changelog.mdx
git add ./services/console/src/types/bencher.ts

Expand Down
2 changes: 1 addition & 1 deletion services/action/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as core from "@actions/core";
import * as toolCache from "@actions/tool-cache";
import { chmod } from "fs/promises";

import swagger from "../../console/src/content/api/swagger.json";
import swagger from "../../../lib/bencher_valid/swagger.json";

const run = async () => {
const cli_version = core.getInput("version");
Expand Down
10 changes: 3 additions & 7 deletions services/api/builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ ARG MOLD_VERSION
RUN curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-$(uname -m)-linux.tar.gz | tar -C /usr/local --strip-components=1 -xzf -
RUN "$(realpath /usr/bin/ld)" != /usr/local/bin/mold && sudo ln -sf /usr/local/bin/mold "$(realpath /usr/bin/ld)"; true

WORKDIR /usr/src
COPY Cargo.toml Cargo.toml

WORKDIR /usr/src/.cargo
COPY .cargo/config.toml config.toml

Expand All @@ -29,18 +26,17 @@ COPY plus/bencher_billing bencher_billing
COPY plus/bencher_license bencher_license

WORKDIR /usr/src
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock
RUN cargo init xtask

WORKDIR /usr/src/services
RUN cargo init cli

WORKDIR /usr/src/services/console/src/content/api
COPY services/console/src/content/api/swagger.json swagger.json

WORKDIR /usr/src/services/api
COPY services/api/migrations migrations
COPY services/api/src src
COPY services/api/Cargo.toml Cargo.toml
COPY services/api/migrations migrations
COPY services/api/diesel.toml diesel.toml

RUN cargo build --release
13 changes: 13 additions & 0 deletions services/api/builder.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Ignore all
*

# Except
!.cargo/
!lib/
!plus/
!Cargo.toml
!Cargo.lock
!services/api/migrations/
!services/api/src/
!services/api/Cargo.toml
!services/api/diesel.toml
5 changes: 5 additions & 0 deletions services/api/litestream.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore all
*

# Except
!entrypoint.sh
2 changes: 2 additions & 0 deletions services/api/local.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore all
*
4 changes: 2 additions & 2 deletions services/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pub const API_VERSION: &str = env!("CARGO_PKG_VERSION");
// So if the `SWAGGER_PATH` below is ever updated
// also update `./git/hooks/pre-push` accordingly.
#[cfg(feature = "swagger")]
pub const SWAGGER_PATH: &str = "../console/src/content/api/swagger.json";
pub const SWAGGER_SPEC_STR: &str = include_str!("../../console/src/content/api/swagger.json");
pub const SWAGGER_PATH: &str = "./swagger.json";
pub const SWAGGER_SPEC_STR: &str = include_str!("../swagger.json");
#[allow(clippy::expect_used)]
pub static SWAGGER_SPEC: Lazy<JsonSpec> = Lazy::new(|| {
JsonSpec(
Expand Down
2 changes: 2 additions & 0 deletions services/console/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore all
*
8 changes: 1 addition & 7 deletions services/console/biome.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": [
"./astro/",
"./netlify/",
"./dist/",
"./src/content/api/swagger.json",
"./src/types/bencher.ts"
]
"ignore": ["./astro/", "./netlify/", "./dist/", "./src/types/bencher.ts"]
},
"linter": {
"enabled": true,
Expand Down
27 changes: 18 additions & 9 deletions services/console/builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,31 @@ RUN "$(realpath /usr/bin/ld)" != /usr/local/bin/mold && sudo ln -sf /usr/local/b

RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

WORKDIR /usr/src
COPY Cargo.toml Cargo.toml
RUN cargo init xtask

WORKDIR /usr/src/.cargo
COPY .cargo/config.toml config.toml

WORKDIR /usr/src/lib
RUN cargo init --lib bencher_adapter
RUN cargo init --lib bencher_boundary
RUN cargo init --lib bencher_json
RUN cargo init --lib bencher_logger
RUN cargo init --lib bencher_plot
RUN cargo init --lib bencher_rbac
RUN cargo init --lib bencher_token
COPY lib/bencher_valid bencher_valid

WORKDIR /usr/src/plus
RUN cargo init --lib bencher_billing
RUN cargo init --lib bencher_license

WORKDIR /usr/src/services
RUN cargo init api
RUN cargo init cli

WORKDIR /usr/src/plus
RUN cargo init bencher_plus --lib

WORKDIR /usr/src/lib
COPY lib/bencher_valid bencher_valid
WORKDIR /usr/src
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock
RUN cargo init xtask

WORKDIR /usr/src/lib/bencher_valid
RUN wasm-pack build --target web --no-default-features --features plus,wasm
Expand Down
16 changes: 16 additions & 0 deletions services/console/builder.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Ignore all
*

# Except
!.cargo/
!lib/bencher_valid/
!Cargo.toml
!Cargo.lock
!services/console/package-lock.json
!services/console/package.json
!services/console/public
!services/console/src
!services/console/astro.config.mjs
!services/console/site.js
!services/console/tsconfig.json
!services/console/.env.runtime
2 changes: 1 addition & 1 deletion services/console/src/util/ext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import swagger from "../content/api/swagger.json";
import swagger from "../../../../lib/bencher_valid/swagger.json";
import { apiHost } from "./http";

export const BENCHER_SITE_URL = "https://bencher.dev";
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/task/swagger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::process::Command;

use crate::parser::CliSwagger;

const SWAGGER_PATH: &str = "./services/console/src/content/api/swagger.json";
const SWAGGER_PATH: &str = "./lib/bencher_valid/swagger.json";

#[derive(Debug)]
pub struct Swagger {}
Expand Down

0 comments on commit 90160be

Please sign in to comment.