Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 50 additions & 50 deletions .github/workflows/order-service.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
name: Order Service

on:
push:
paths:
- order-service/**
branches:
- 'main'
pull_request:
branches: [main]

jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
working-directory: ./order-service
DOCKER_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/bookstore-order-service
defaults:
run:
working-directory: ${{ env.working-directory }}
steps:
- uses: actions/checkout@v4

- name: Setup Java 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'

- name: Make Maven wrapper executable
run: chmod +x mvnw

- name: Check code formatting (Spotless)
run: ./mvnw spotless:check

- name: Build with Maven
run: ./mvnw -ntp verify

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Publish Docker Image
run: |
./mvnw spring-boot:build-image -DskipTests
echo "Pushing the image $DOCKER_IMAGE_NAME to Docker Hub..."
name: Order Service
on:
push:
paths:
- order-service/**
branches:
- 'main'
pull_request:
branches: [main]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
working-directory: ./order-service
DOCKER_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/bookstore-order-service
defaults:
run:
working-directory: ${{ env.working-directory }}
steps:
- uses: actions/checkout@v4
- name: Setup Java 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Make Maven wrapper executable
run: chmod +x mvnw
- name: Check code formatting (Spotless)
run: ./mvnw spotless:check
- name: Build with Maven
run: ./mvnw -ntp verify
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Publish Docker Image
run: |
./mvnw spring-boot:build-image -DskipTests
echo "Pushing the image $DOCKER_IMAGE_NAME to Docker Hub..."
docker push $DOCKER_IMAGE_NAME
38 changes: 19 additions & 19 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
154 changes: 77 additions & 77 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
version: '3'

vars:
GOOS: "{{default OS .GOOS}}"
MVNW: '{{if eq .GOOS "windows"}}mvnw.cmd{{else}}./mvnw{{end}}'
DC_DIR: "deployment/docker-compose"
INFRA_DC_FILE: "{{.DC_DIR}}/infra.yml"
APPS_DC_FILE: "{{.DC_DIR}}/apps.yml"
PORTAINER_DC_FILE: "devtools/docker-compose/portainer.yml"
SLEEP_CMD: '{{if eq .GOOS "windows"}}timeout{{else}}sleep{{end}}'

tasks:
default:
cmds:
- task: test
test:
deps: [format]
cmds:
- "{{.MVNW}} clean verify"

format:
cmds:
- "{{.MVNW}} spotless:apply"

build:
cmds:
- "{{.MVNW}} -pl catalog-service spring-boot:build-image -DskipTests"

start_infra:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} up -d"

stop_infra:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} stop"
- "docker compose -f {{.INFRA_DC_FILE}} rm -f"

restart_infra:
cmds:
- task: stop_infra
- task: sleep
- task: start_infra

start:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} -f {{.APPS_DC_FILE}} up -d"

stop:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} -f {{.APPS_DC_FILE}} stop"
- "docker compose -f {{.INFRA_DC_FILE}} -f {{.APPS_DC_FILE}} rm -f"

restart:
cmds:
- task: stop
- task: sleep
- task: start

start_portainer:
cmds:
- "docker compose -f {{.PORTAINER_DC_FILE}} up -d"

stop_portainer:
cmds:
- "docker compose -f {{.PORTAINER_DC_FILE}} stop"
- "docker compose -f {{.PORTAINER_DC_FILE}} rm -f"

restart_portainer:
cmds:
- task: stop_portainer
- task: sleep
- task: start_portainer

sleep:
vars:
DURATION: "{{default 5 .DURATION}}"
cmds:
version: '3'
vars:
GOOS: "{{default OS .GOOS}}"
MVNW: '{{if eq .GOOS "windows"}}mvnw.cmd{{else}}./mvnw{{end}}'
DC_DIR: "deployment/docker-compose"
INFRA_DC_FILE: "{{.DC_DIR}}/infra.yml"
APPS_DC_FILE: "{{.DC_DIR}}/apps.yml"
PORTAINER_DC_FILE: "devtools/docker-compose/portainer.yml"
SLEEP_CMD: '{{if eq .GOOS "windows"}}timeout{{else}}sleep{{end}}'
tasks:
default:
cmds:
- task: test
test:
deps: [format]
cmds:
- "{{.MVNW}} clean verify"
format:
cmds:
- "{{.MVNW}} spotless:apply"
build:
cmds:
- "{{.MVNW}} -pl catalog-service spring-boot:build-image -DskipTests"
start_infra:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} up -d"
stop_infra:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} stop"
- "docker compose -f {{.INFRA_DC_FILE}} rm -f"
restart_infra:
cmds:
- task: stop_infra
- task: sleep
- task: start_infra
start:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} -f {{.APPS_DC_FILE}} up -d"
stop:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} -f {{.APPS_DC_FILE}} stop"
- "docker compose -f {{.INFRA_DC_FILE}} -f {{.APPS_DC_FILE}} rm -f"
restart:
cmds:
- task: stop
- task: sleep
- task: start
start_portainer:
cmds:
- "docker compose -f {{.PORTAINER_DC_FILE}} up -d"
stop_portainer:
cmds:
- "docker compose -f {{.PORTAINER_DC_FILE}} stop"
- "docker compose -f {{.PORTAINER_DC_FILE}} rm -f"
restart_portainer:
cmds:
- task: stop_portainer
- task: sleep
- task: start_portainer
sleep:
vars:
DURATION: "{{default 5 .DURATION}}"
cmds:
- "{{.SLEEP_CMD}} {{.DURATION}}"
4 changes: 2 additions & 2 deletions catalog-service/.gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf
/mvnw text eol=lf
*.cmd text eol=crlf
66 changes: 33 additions & 33 deletions catalog-service/.gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
HELP.md
target/
.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
HELP.md
target/
.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
Loading
Loading