-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (70 loc) · 2.2 KB
/
ci-hlg.yaml
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
name: CI HLG
on:
pull_request:
branches:
- 'release/*'
jobs:
check-application:
strategy:
matrix:
ubuntu: ['ubuntu-latest']
java: ['17']
runs-on: ${{ matrix.ubuntu }}
services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: ${{ secrets.DB_PASSWORD }}
MYSQL_DATABASE: ${{ secrets.DB_NAME }}
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10
env:
DB_NAME: ${{ secrets.DB_NAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_HOST: 127.0.0.1
DB_PORT: 3306
steps:
- name: Checkout codigo
uses: actions/checkout@v3
- name: check PR head branch
run: |
if [[ "${{ github.head_ref }}" != develop ]]; then
echo "PRs to main must come from a develop branch. PR is from '${{ github.head_ref }}'"
exit 1
fi
- name: Get branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_BASE_REF#release/} | cut -d'/' -f2)" >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: ${{ matrix.java }}
- name: Setup Maven
run: |
sudo apt-get install -y maven
- name: Install Dependencies
run: mvn clean install -DskipTests
- name: Run Tests
run: mvn test
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
tags: diegoneves/conectar-doacoes:${{ env.BRANCH_NAME }}-beta
build-args: |
DB_NAME=${{ env.DB_NAME }}
DB_PASSWORD=${{ env.DB_PASSWORD }}
DB_USERNAME=${{ env.DB_USERNAME }}