-
Notifications
You must be signed in to change notification settings - Fork 3
92 lines (85 loc) · 2.96 KB
/
Copy pathFullPipe.yml
File metadata and controls
92 lines (85 loc) · 2.96 KB
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
name: Unit Test + Docker Image
#Test again
on:
push:
paths-ignore:
- 'swagger/**'
- '**/README.md'
- '**/.gitignore'
branches:
- 'main'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow isn't split up, because the gradle daemon takes FOREVER to start
test-and-build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.6.5
env:
MYSQL_PASSWORD: robot
MYSQL_USER: robot
MYSQL_DATABASE: robot
MYSQL_ROOT_PASSWORD: root
ports:
- '3306:3306'
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set up JDK 11 + cache
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
# Setup gradle cache
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1.0.4
- name: Unit Test
# since it's h2, it is kind of unnecessary
env:
DB_PASSWORD: robot
DB_USER: robot
DB_NAME: robot
DB_HOST: localhost:3306
run: ./gradlew test --build-cache --parallel
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image to github registry
run: >
./gradlew jib
-Djib.to.image=ghcr.io/the-microservice-dungeon/robot/robotservice
-Djib.from.image=eclipse-temurin:17-alpine
--parallel
--build-cache
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
rm -f $GRADLE_USER_HOME/caches/modules-2/gc.properties
deploy:
needs: test-and-build
runs-on: ubuntu-latest
steps:
- name: stop-pull-run
uses: appleboy/ssh-action@1d1b21ca96111b1eb4c03c21c14ebb971d2200f6
env:
SERVICE_NAME: robot
with:
host: cides03.gm.fh-koeln.de
username: ${{ secrets.PROD_USER }}
password: ${{ secrets.PROD_PWD }}
port: 22
envs: SERVICE_NAME
script: |
echo ${{ secrets.PROD_PWD }} | sudo -S docker-compose -f $SERVICE_NAME/service-compose.yml pull
echo ${{ secrets.PROD_PWD }} | sudo -S docker-compose -f $SERVICE_NAME/service-compose.yml up -d