Skip to content
Open
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
29 changes: 29 additions & 0 deletions .github/workflows/03-minhas-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 03 - Actions 1.0

on:
push:
branches: "feature/**"

jobs:
checkout_java_docker:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"

- name: Build
uses: docker/build-push-action@v6
with:
push: false

- name: Executar scripts
run: |
git branch
java --version
mvn clean package
19 changes: 19 additions & 0 deletions .github/workflows/continuous_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Continuous Integration
on:
pull_request:
types: [opened, reopened]
branches: "feature/**"
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Unit tests
run: mvn test
41 changes: 41 additions & 0 deletions .github/workflows/contiunous-delivery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
push:
branches: "feature/main"

env:
IMAGE_NAME: simple-api-java
AZURE_WEBAPP_NAME: fiap-simple-api-java-dev

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: "ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest"
18 changes: 18 additions & 0 deletions .github/workflows/meu-primeiro-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 01 - Meu primeiro workflow
on: push

jobs:
job1-hello:
runs-on: ubuntu-latest
steps:
- name: Imprimir mensagem
run: echo "Olá, Mundo"
job2-goodbye:
runs-on: ubuntu-latest
steps:
- name: Step 1 - Sequencia de instruções
run: |
echo "Uma nova instrução"
ls
- name: Step 2 - Imprimir mensagem
run: echo "Até logo!"
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Simple API Java

Aplicação API
Aplicação API

## Pré-requisitos

Expand All @@ -14,14 +14,12 @@ Aplicação API
docker compose up --build
```

## Testes unitários (validação)
## Testes unitários (validação - aula)

./mvnw test


## Documentação online (OpenAPI)

http://localhost:8080/swagger-ui/index.html

![](/assets/images/swagger.png)

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void testGivenNewProduto_whenCreate_thenSavedProduto() throws Exception{
@DisplayName("test fail")
@Test
void testGivenNewProduto_whenCreate_thenFail() throws Exception{
// fail("Um erro acontecerá");
//fail("Um erro acontecerá");
}

}