-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (82 loc) · 2.28 KB
/
main.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Build project
on: [ push ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "corretto"
java-version: "17"
cache: "gradle"
- name: Validate styles
uses: pre-commit/[email protected]
- name: Build project
uses: gradle/gradle-build-action@v3
with:
arguments: clean build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: jar
path: "*-service/build/libs/*.jar"
retention-days: 1
test:
name: Integration Test
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: actions/download-artifact@v4
with:
name: jar
path: .
- name: Build images
timeout-minutes: 5
run: docker compose build
- name: Run containers
id: run-containers
timeout-minutes: 10
run: |
docker compose up -d --wait
env:
OAUTH2_SECURITY_ENABLED: true
- name: Print logs
if: ${{ failure() && steps.run-containers.outcome != 'success' }}
run: |
docker compose logs
- name: Run API Tests
uses: matt-ball/newman-action@master
with:
collection: tests/postman/collection.json
environment: tests/postman/local-environment.json
delayRequest: 100
reporters: '["cli"]'
- name: Stop containers
if: ${{ always() }}
continue-on-error: true
run: docker compose down -v
publish:
name: Publish to Docker Hub
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: jar
path: .
- name: Build images
timeout-minutes: 5
run: docker compose build
- name: Push images
run: docker compose push