Skip to content

Commit

Permalink
Merge pull request #266 from sohosai/develop
Browse files Browse the repository at this point in the history
deploy 20240427
  • Loading branch information
arata-nvm authored Apr 27, 2024
2 parents 49bb962 + c89464f commit ca7dd44
Show file tree
Hide file tree
Showing 38 changed files with 3,909 additions and 2,855 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/cd-beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
jobs:
push-image:
if: github.event.pull_request.merged == true || github.event.inputs.deploy-only == 'false'
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
cache-to: type=gha,mode=max

deploy:
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
needs: push-image
if: |
(github.event.pull_request.merged == true && always() && !failure() && !cancelled()) ||
Expand All @@ -81,6 +81,12 @@ jobs:
- uses: actions/checkout@v4
with:
ref: develop
- name: ubuntu mirror
run: sudo sed -i.bak -r 's@http://(jp\.)?archive\.ubuntu\.com/ubuntu/?@https://ftp.udx.icscoe.jp/Linux/ubuntu/@g' /etc/apt/sources.list
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: sudo apt-get update && sudo apt-get install -y jq
- name: Deploy to Portainer
run: |
# List stacks
Expand Down Expand Up @@ -122,9 +128,9 @@ jobs:
VERIFY_SSL: "true"

notify:
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
needs: [push-image, deploy]
if: always() && !failure() && !cancelled()
if: always() && !cancelled()
steps:
- name: Notify
uses: sarisia/actions-status-discord@v1
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/cd-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
jobs:
push-image:
if: github.event.pull_request.merged == true || github.event.inputs.deploy-only == 'false'
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
cache-to: type=gha,mode=max

deploy:
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
needs: push-image
if: |
(github.event.pull_request.merged == true && always() && !failure() && !cancelled()) ||
Expand All @@ -84,6 +84,12 @@ jobs:
- uses: actions/checkout@v4
with:
ref: develop
- name: ubuntu mirror
run: sudo sed -i.bak -r 's@http://(jp\.)?archive\.ubuntu\.com/ubuntu/?@https://ftp.udx.icscoe.jp/Linux/ubuntu/@g' /etc/apt/sources.list
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: sudo apt-get update && sudo apt-get install -y jq
- name: Deploy to Portainer
run: |
# List stacks
Expand Down Expand Up @@ -125,9 +131,9 @@ jobs:
VERIFY_SSL: "true"

notify:
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
needs: [push-image, deploy]
if: always() && !failure() && !cancelled()
if: always() && !cancelled()
steps:
- name: Notify
uses: sarisia/actions-status-discord@v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
jobs:
push-image:
if: github.event.pull_request.merged == true || github.event.inputs.deploy-only == 'false'
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
cache-to: type=gha,mode=max

deploy:
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
needs: push-image
if: |
(github.event.pull_request.merged == true && always() && !failure() && !cancelled()) ||
Expand Down Expand Up @@ -123,9 +123,9 @@ jobs:
rm .env"
notify:
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
needs: [push-image, deploy]
if: always() && !failure() && !cancelled()
if: always() && !cancelled()
steps:
- name: Notify
uses: sarisia/actions-status-discord@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: [self-hosted, portainer]
runs-on: [self-hosted, garm]
steps:
- uses: actions/checkout@v4
- name: Symlink
Expand Down
47 changes: 47 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ tower-http = { version = "0.5.1", features = ["cors", "trace"] }
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
unicode-segmentation = "1.11.0"
utoipa = { version = "4.2.0", features = ["axum_extras", "yaml"] }
uuid = { version = "1.7.0", features = ["v4", "serde"] }
url = "2.5.0"
percent-encoding = "2.3.1"
1 change: 1 addition & 0 deletions crates/sos24-presentation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ tower.workspace = true
tower-http.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
utoipa.workspace = true
11 changes: 11 additions & 0 deletions crates/sos24-presentation/src/bin/gen-openapi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use sos24_presentation::route::ApiDoc;
use utoipa::OpenApi;

fn main() {
let doc = generate_openapi();
print!("{doc}");
}

fn generate_openapi() -> String {
ApiDoc::openapi().to_yaml().unwrap()
}
4 changes: 3 additions & 1 deletion crates/sos24-presentation/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use axum::{
Json,
};
use serde::Serialize;
use utoipa::ToSchema;

pub mod convert_error;

Expand All @@ -23,7 +24,8 @@ impl AppError {
}
}

#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, ToSchema)]
#[schema(as = Error)]
pub struct ErrorResponse {
code: String,
message: String,
Expand Down
34 changes: 28 additions & 6 deletions crates/sos24-presentation/src/model/file.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
use serde::{Deserialize, Serialize};

use sos24_use_case::dto::file::{FileDto, FileInfoDto};
use utoipa::{IntoParams, ToSchema};

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, ToSchema)]
pub struct File {
#[schema(format = "uuid")]
pub id: String,
#[schema(format = "uri")]
pub url: String,
pub name: String,
#[schema(format = "uuid")]
pub owner: Option<String>,
#[schema(format = "date-time")]
pub created_at: String,
#[schema(format = "date-time")]
pub updated_at: String,
#[schema(format = "date-time")]
pub deleted_at: Option<String>,
}

Expand All @@ -27,25 +34,37 @@ impl From<FileDto> for File {
}
}

#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, IntoParams)]
pub struct CreateFileQuery {
#[param(inline)]
pub visibility: Visibility,
}

#[derive(Debug, Deserialize)]
#[derive(ToSchema)]
pub struct CreateFile {
#[schema(format = "binary")]
pub file: String,
}

#[derive(Debug, Deserialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum Visibility {
Private,
Public,
}

#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, ToSchema)]
pub struct FileInfo {
#[schema(format = "uuid")]
pub id: String,
pub filename: String,
#[schema(format = "uuid")]
pub owner: Option<String>,
#[schema(format = "date-time")]
pub created_at: String,
#[schema(format = "date-time")]
pub updated_at: String,
#[schema(format = "date-time")]
pub deleted_at: Option<String>,
}

Expand All @@ -62,13 +81,16 @@ impl From<FileInfoDto> for FileInfo {
}
}

#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, ToSchema)]
pub struct CreatedFile {
#[schema(format = "uuid")]
pub ids: Vec<String>,
}

#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, IntoParams)]
pub struct ExportFileQuery {
#[param(format = "uuid")]
pub project_id: Option<String>,
#[param(format = "uuid")]
pub form_id: Option<String>,
}
Loading

0 comments on commit ca7dd44

Please sign in to comment.