Skip to content

Commit

Permalink
feat(ci): add reviewdog
Browse files Browse the repository at this point in the history
* feat(ci): add reviewdog

* fix(proto): reviewdog lint

* fix(ci): reviewdog
  • Loading branch information
jorgechato authored Mar 15, 2024
1 parent 1a211e2 commit 6067f88
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/.protolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# Lint directives.
lint:
directories:
exclude:
- third_party
- garajonai
- scripts
- vendor
- proto/example

# Linter rules.
# Run `protolint list` to see all available rules.
rules:
# Determines whether or not to include the default set of linters.
no_default: true

# Set the default to all linters. This option works the other way around as no_default does.
# If you want to enable this option, delete the comment out below and no_default.
# all_default: true

# The specific linters to add.
add:
- INDENT
- MESSAGES_HAVE_COMMENT
- SERVICES_HAVE_COMMENT
- RPCS_HAVE_COMMENT
- PROTO3_FIELDS_AVOID_REQUIRED
- PROTO3_GROUPS_AVOID
- REPEATED_FIELD_NAMES_PLURALIZED
- ENUMS_HAVE_COMMENT
- ENUM_FIELDS_HAVE_COMMENT
- SYNTAX_CONSISTENT
- QUOTE_CONSISTENT
- RPC_NAMES_UPPER_CAMEL_CASE

# Linter rules option.
rules_option:
indent:
style: 4
not_insert_newline: true

# QUOTE_CONSISTENT rule option.
quote_consistent:
# Available quote are "double" or "single".
quote: double

# ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH rule option.
enum_field_names_zero_value_end_with:
suffix: INVALID

# RPC_NAMES_CASE rule option.
rpc_names_case:
# The specific convention the name should conforms to.
## Available conventions are "lower_camel_case", "upper_snake_case", or "lower_snake_case".
convention: upper_snake_case

# SYNTAX_CONSISTENT rule option.
syntax_consistent:
# Default is proto3.
version: proto3
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* @garajonai/family
proto/iam*/ @jorgechato
scripts/go/ @jorgechato
scripts/nodejs/ @jorgechato
scripts/rust/ @jorgechato
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"

- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
42 changes: 42 additions & 0 deletions .github/workflows/reviewdog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Review Dog"
on:
pull_request:
permissions:
checks: write
contents: write
issues: write
pull-requests: write

jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Load secrets
uses: garajonai/workflows-lib/load-secrets@main
id: botanibit
with:
op-token: ${{ secrets.OP_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.botanibit.outputs.token }}

- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Setup reviewdog
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest

- name: Setup protolint
run: go install github.com/yoheimuta/protolint/cmd/protolint@latest

- name: Run reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ steps.botanibit.outputs.token }}
run: protolint -config_path=.github/.protolint.yml proto | reviewdog -name="protolint" -fail-on-error=true -level=info -reporter="github-pr-review" -f=protolint -filter-mode=added
8 changes: 8 additions & 0 deletions proto/iam-roots-account/api/v1/accountapi/accountapi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ option go_package = "github.com/garajonai/client-go/iam-roots-account/api/bff/v1
import "google/api/annotations.proto";
import "garajonai/platform/proto/iam-roots-account/api/v1/webauthn.proto";


// IAMRootsAccountApi BFF service
service IAMRootsAccountApi {
// StartWebauthnRegistration starts a WebAuthn registration process
rpc StartWebauthnRegistration(StartWebauthnRegistrationRequest) returns (StartWebauthnRegistrationResponse) {
option (google.api.http) = {
post: "/registration/webauthn/start"
body: "*"
};
}
// FinishWebauthnRegistration finishes a WebAuthn registration process
rpc FinishWebauthnRegistration(FinishWebauthnRegistrationRequest) returns (FinishWebauthnRegistrationResponse) {
option (google.api.http) = {
post: "/registration/webauthn/finish"
Expand All @@ -23,14 +27,17 @@ service IAMRootsAccountApi {
}


// StartWebauthnRegistrationRequest is the request message for StartWebauthnRegistration
message StartWebauthnRegistrationRequest {
string email = 1;
}

// StartWebauthnRegistrationResponse is the response message for StartWebauthnRegistration
message StartWebauthnRegistrationResponse {
garajonai.platform.iamrootsaccount.api.v1.PublicKey public_key = 1;
}

// FinishWebauthnRegistrationRequest is the request message for FinishWebauthnRegistration
message FinishWebauthnRegistrationRequest {
string email = 1;
string id = 2;
Expand All @@ -40,6 +47,7 @@ message FinishWebauthnRegistrationRequest {
garajonai.platform.iamrootsaccount.api.v1.AttestationResponse response = 6;
}

// FinishWebauthnRegistrationResponse is the response message for FinishWebauthnRegistration
message FinishWebauthnRegistrationResponse {
string status = 1;
}
10 changes: 10 additions & 0 deletions proto/iam-roots-account/api/v1/user_account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,41 @@ package garajonai.platform.iamrootsaccount.api.v1;
option go_package = "github.com/garajonai/client-go/iam-roots-account/api/v1;account";


// UserAccount is the service that provides user account information.
service UserAccount {
// GetUserInfo returns the user information.
rpc GetUserInfo(GetUserInfoRequest) returns (GetUserInfoResponse);
// InsertUserInfo inserts the user information.
rpc InsertUserInfo(InsertUserInfoRequest) returns (InsertUserInfoResponse);
// DeleteUserInfo deletes the user information.
rpc DeleteUserInfo(DeleteUserInfoRequest) returns (DeleteUserInfoResponse);
}

// GetUserInfoRequest is the request message for GetUserInfo.
message GetUserInfoRequest {
string id = 1;
}

// GetUserInfoResponse is the response message for GetUserInfo.
message GetUserInfoResponse {
}

// InsertUserInfoRequest is the request message for InsertUserInfo.
message InsertUserInfoRequest {
string email = 1;
string subject = 2;
}

// InsertUserInfoResponse is the response message for InsertUserInfo.
message InsertUserInfoResponse {
}

// DeleteUserInfoRequest is the request message for DeleteUserInfo.
message DeleteUserInfoRequest {
string id = 1;
}

// DeleteUserInfoResponse is the response message for DeleteUserInfo.
message DeleteUserInfoResponse {
}

Expand Down
1 change: 1 addition & 0 deletions proto/iam-roots-account/api/v1/webauthn.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "google/api/field_behavior.proto";
import "garajonai/platform/proto/iam-roots-account/api/v1/user_account.proto";


// Webauthn service is used to register and revoke Webauthn credentials.
service Webauthn {
rpc StartRegistration(StartRegistrationRequest) returns (StartRegistrationResponse);
rpc FinishRegistration(FinishRegistrationRequest) returns (FinishRegistrationResponse);
Expand Down

0 comments on commit 6067f88

Please sign in to comment.