-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (62 loc) · 1.73 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: CI/CD Workflow
run-name: ${{ github.actor }} has started workflow
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
actions: read
checks: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
## Set up to use JDK 17
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
## Build and execute every test
- name: Build with Maven
run: mvn -B package -DskipTests --file pom.xml
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
DATABASE_PRO: ${{ secrets.DATABASE_PROD }}
DATABASE_TEST: ${{ secrets.DATABASE_TEST }}
## Build and execute every test
- name: Executing Tests
run: mvn test
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
DATABASE_PRO: ${{ secrets.DATABASE_PROD }}
DATABASE_TEST: ${{ secrets.DATABASE_TEST }}
## Generate Test Report Summary
- name: Test Report
uses: dorny/test-reporter@v1.7.0
if: always()
with:
name: Test Reporter Summary
path: target/surefire-reports/*.xml
reporter: java-junit
## Jacoco report
- name: Jacoco Report
id: jacoco
uses: madrapps/jacoco-report@v1.6.1
with:
paths: |
${{ github.workspace }}/target/site/jacoco/jacoco.xml,
token: ${{ secrets.SECRET_TOKEN }}
min-coverage-overall: 40
min-coverage-changed-files: 60
docker:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker Image
run: docker build . --file Dockerfile --tag alura-flix-api:$(date +%s)