Skip to content

Commit 4cbdfe0

Browse files
committed
Add CI to check E2E Build & Deploy pipeline
1 parent c05dc3f commit 4cbdfe0

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Continuous Integration
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:15
16+
ports:
17+
- 5432:5432
18+
env:
19+
POSTGRES_DB: postgres
20+
POSTGRES_USER: postgres
21+
POSTGRES_PASSWORD: YOU_MUST_CHANGE_THIS_PASSWORD
22+
options: >-
23+
--health-cmd pg_isready
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v3
31+
32+
- name: Set up Java
33+
uses: actions/setup-java@v3
34+
with:
35+
distribution: 'corretto'
36+
java-version: '17'
37+
38+
- name: Start Tomcat
39+
run: |
40+
docker run -d --network=host --name tomcat tomcat:latest
41+
42+
- name: Setup Gradle
43+
uses: gradle/gradle-build-action@v2
44+
with:
45+
gradle-version: release-candidate
46+
47+
- name: Create database table
48+
run: |
49+
psql -h localhost -U postgres -d postgres -f ./app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql
50+
env:
51+
PGPASSWORD: YOU_MUST_CHANGE_THIS_PASSWORD
52+
53+
- name: Build and Deploy
54+
run: |
55+
# Print Info
56+
java -version
57+
gradle --version
58+
59+
gradle wrapper --gradle-version 8.1.1
60+
./gradlew --version
61+
./gradlew build
62+
63+
docker cp app/build/libs/app-1.0.war tomcat:/usr/local/tomcat/webapps/vss.war
64+
65+
- name: Hit endpoint to verify service is up
66+
run: |
67+
# Wait for tomcat-startup
68+
sleep 5
69+
70+
# Put request with store='storeId' and key=k1
71+
hex=0A0773746F726549641A150A026B3110FFFFFFFFFFFFFFFFFF011A046B317631
72+
curl --data-binary "$(echo "$hex" | xxd -r -p)" http://localhost:8080/vss/putObjects
73+
74+
# Get request with store='storeId' and key=k1
75+
hex=0A0773746F7265496412026B31
76+
curl --data-binary "$(echo "$hex" | xxd -r -p)" http://localhost:8080/vss/getObject
77+
78+
- name: Cleanup
79+
run: |
80+
docker stop tomcat && docker rm tomcat

0 commit comments

Comments
 (0)