Skip to content

Commit dc8aaa7

Browse files
Adds CI for running tests.
1 parent 927d3be commit dc8aaa7

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: Java CI with Maven
5+
6+
on:
7+
pull_request:
8+
branches: [ main, development ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
# Service containers to run with `container-job`
15+
services:
16+
# Label used to access the service container
17+
postgres:
18+
# Docker Hub image
19+
image: postgres
20+
# Provide the password for postgres
21+
env:
22+
POSTGRES_PASSWORD: admin
23+
# Set health checks to wait until postgres has started
24+
options: >-
25+
--health-cmd pg_isready
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
ports:
30+
# Maps tcp port 5432 on service container to the host
31+
- 5432:5432
32+
33+
mongo:
34+
# Mongo Docker Hub image
35+
image: mongo
36+
# Provide the username, password and connection string for mongo
37+
env:
38+
ME_CONFIG_MONGODB_ADMINUSERNAME: admin
39+
ME_CONFIG_MONGODB_ADMINPASSWORD: admin
40+
ME_CONFIG_MONGODB_URL: mongodb://admin:admin@mongo:27017/
41+
# Set health checks to wait until mongo has started
42+
options: >-
43+
--health-cmd mongo
44+
--health-interval 10s
45+
--health-timeout 5s
46+
--health-retries 5
47+
# Maps tcp port 27017 on service container to the host
48+
ports:
49+
- 27017:27017
50+
51+
steps:
52+
- uses: actions/checkout@v2
53+
- name: Set up JDK 11
54+
uses: actions/setup-java@v2
55+
with:
56+
java-version: '11'
57+
distribution: 'adopt'
58+
cache: maven
59+
settings-path: ${{ github.workspace }} # location for the settings.xml file
60+
- name: Setup Postgres
61+
run: psql -f ci/sql/setup_postgres.sql postgresql://postgres:admin@localhost:5432/postgres
62+
- name: Check status of Mongo
63+
run: mongo test --eval "printjson(db.getSiblingDB('TestDB'), db.getCollectionNames())"
64+
- name: Build with Maven
65+
run: |
66+
mkdir -p ~/.m2
67+
echo "<settings><servers><server><id>Eclipse BaSyx SDK GitHub Packages</id><username>x-access-token</username><password>${GITHUB_TOKEN}</password></server></servers></settings>" > ~/.m2/settings.xml
68+
mvn -B package --file basyx.components/pom.xml
69+
env:
70+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)