Skip to content

Commit

Permalink
Merge pull request #112 from averak/release/v0.4.0
Browse files Browse the repository at this point in the history
Release/v0.4.0
  • Loading branch information
averak authored Jan 22, 2024
2 parents d0090b8 + 1376d71 commit 29cc1fb
Show file tree
Hide file tree
Showing 77 changed files with 3,434 additions and 452 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CD

on:
release:
types:
- created

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: determine docker tag
id: docker_tag
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const tagExec = await exec.getExecOutput('git', ['describe', '--tags', '--abbrev=0']);
return tagExec.stdout || tagExec.stderr;
- name: build docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.docker_tag.outputs.result }}
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
Expand Down Expand Up @@ -50,8 +50,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
Expand All @@ -65,10 +65,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: build docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: false
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PROTOC_GEN_JAVA_VERSION=1.61.0
PROTOC_GEN_JAVA_PATH=tmp/bin/protoc-gen-grpc-java.exe
PROTOC_GEN_JAVA_PATH=tmp/bin/protoc-gen-grpc-java-${PROTOC_GEN_JAVA_VERSION}.exe

.PHONY: build
build:
Expand All @@ -19,9 +19,13 @@ format:

.PHONY: install-protoc-gen-plugin
install-protoc-gen-plugin:
./gradlew :protoc-gen-java-gsync-server:build
chmod +x ./protoc-gen-java-gsync-server/build/scripts/protoc-gen-java-gsync-server
mkdir -p tmp/bin
wget https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/${PROTOC_GEN_JAVA_VERSION}/protoc-gen-grpc-java-${PROTOC_GEN_JAVA_VERSION}-osx-x86_64.exe -O ${PROTOC_GEN_JAVA_PATH}
chmod +x ${PROTOC_GEN_JAVA_PATH}
if [ ! -f ${PROTOC_GEN_JAVA_PATH} ]; then \
wget https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/${PROTOC_GEN_JAVA_VERSION}/protoc-gen-grpc-java-${PROTOC_GEN_JAVA_VERSION}-osx-x86_64.exe -O ${PROTOC_GEN_JAVA_PATH}; \
chmod +x ${PROTOC_GEN_JAVA_PATH}; \
fi

.PHONY: codegen
codegen:
Expand All @@ -30,9 +34,11 @@ codegen:
find ./schema/protobuf -name "*.proto" | xargs -I {} protoc \
-I=schema/protobuf \
--plugin=protoc-gen-grpc-java=${PROTOC_GEN_JAVA_PATH} \
--plugin=protoc-gen-java-gsync-server=./protoc-gen-java-gsync-server/protoc-gen-java-gsync-server \
--java_out=protobuf/src/main/java \
--java-gsync-server_out=protobuf/src/main/java \
--grpc-java_out=protobuf/src/main/java {}
./gradlew mbGenerate
#./gradlew mbGenerate
./gradlew spotlessApply

.PHONY: db-apply
Expand Down

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExcep
@RestControllerAdvice
class GlobalRestControllerAdvice(
private val customLogger: Logger,
private val requestScope: HttpRequestScope,
private val requestScope: RequestScope,
) : ResponseEntityExceptionHandler() {

@RequestMapping("/**")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.time.LocalDateTime
@RestController
@RequestMapping(path = ["/api/health"], produces = [MediaType.APPLICATION_JSON_VALUE])
class HealthCheckController(
private val requestScope: HttpRequestScope,
private val requestScope: RequestScope,
private val echoUsecase: EchoUsecase,
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.time.format.DateTimeFormatter
import java.util.*

@Component
class HttpRequestScope(
class RequestScope(
private val config: Config,
private val httpServletRequest: HttpServletRequest,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.averak.gsync.adapter.handler.admin_api.interceptor

import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope
import net.averak.gsync.adapter.handler.admin_api.RequestScope
import net.averak.gsync.core.logger.Logger
import org.springframework.http.HttpStatusCode
import org.springframework.stereotype.Component
Expand All @@ -16,7 +16,7 @@ import java.time.LocalDateTime
@Component
class AccessLogInterceptor(
private val logger: Logger,
private val requestScope: HttpRequestScope,
private val requestScope: RequestScope,
) : IRequestInterceptor {

override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean {
Expand Down

This file was deleted.

Loading

0 comments on commit 29cc1fb

Please sign in to comment.