forked from lightningdevkit/vss-server
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (65 loc) · 2.19 KB
/
build-and-deploy-java.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
name: Continuous Integration
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
ports:
- 5432:5432
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: YOU_MUST_CHANGE_THIS_PASSWORD
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Start Tomcat
run: |
docker run -d --network=host --name tomcat tomcat:latest
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: release-candidate
- name: Create database table
run: |
psql -h localhost -U postgres -d postgres -f ./java/app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql
env:
PGPASSWORD: YOU_MUST_CHANGE_THIS_PASSWORD
- name: Build and Deploy
run: |
# Print Info
java -version
gradle --version
cd java
gradle wrapper --gradle-version 8.1.1
./gradlew --version
./gradlew build
docker cp app/build/libs/vss-1.0.war tomcat:/usr/local/tomcat/webapps/vss.war
- name: Hit endpoint to verify service is up
run: |
# Wait for tomcat-startup
sleep 5
# Put request with store='storeId' and key=k1
hex=0A0773746F726549641A150A026B3110FFFFFFFFFFFFFFFFFF011A046B317631
curl --data-binary "$(echo "$hex" | xxd -r -p)" http://localhost:8080/vss/putObjects
# Get request with store='storeId' and key=k1
hex=0A0773746F7265496412026B31
curl --data-binary "$(echo "$hex" | xxd -r -p)" http://localhost:8080/vss/getObject
- name: Cleanup
run: |
docker stop tomcat && docker rm tomcat