Skip to content

Commit

Permalink
ci: add CI workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilhermebit authored Sep 13, 2024
1 parent 75bba3c commit 1db7dc6
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: CI

on:
push:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo
ports:
- 27017:27017
env:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password
rabbitmq:
image: rabbitmq:3.13-management
ports:
- 5672:5672
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Run Tests with Maven
run: mvn test --file pom.xml

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

- name: Build and Push Docker Image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: true
tags: |
guibitencurt/order-microservice-rabbit-mongo:${{github.run_number}}
guibitencurt/order-microservice-rabbit-mongo:latest

0 comments on commit 1db7dc6

Please sign in to comment.