forked from ron190/jsql-injection
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (82 loc) · 3.45 KB
/
maven.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Java CI with Maven and Docker
on:
push:
branches: [ master ]
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
build:
name: Run tests on Docker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- jdk: 3.8.1-jdk-11-slim
nashorn: -Dnashorn.args=--no-deprecation-warning
- jdk: 3.8.1-openjdk-15-slim
nashorn: ""
env:
JSQL_DOCKERFILE: ${{ matrix.jdk }}
MAVEN_NASHORN: ${{ matrix.nashorn }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
# Disable shallow clone to send Git blame to Sonar
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 14
- name: Set Maven dependencies cache
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Install Maven dependencies
run: |
mvn clean install -DskipTests dependency:tree
- name: Build and start databases Docker images
run: |
docker-compose -f ./model/src/test/resources/docker/docker-compose.yml build --parallel
docker-compose -f ./model/src/test/resources/docker/docker-compose.yml up -d
./model/src/test/resources/docker/healthcheck/healthcheck.sh
./model/src/test/resources/docker/script/buff.sh
./model/src/test/resources/docker/script/verify.sh
- name: Build project Docker container
run: |
docker rmi jsql:latest -f
docker build -t jsql:latest --build-arg JSQL_DOCKERFILE -f model/src/test/resources/docker/Dockerfile.jsql .
- name: Run unit and integration tests
run: |
docker run \
-t \
--rm \
-v "$HOME/.m2":/root/.m2 \
-v "$HOME/.sonar/cache":/root/.sonar/cache \
--network docker_jsql-network \
-e SONAR_TOKEN \
-e CODACY_PROJECT_TOKEN \
-e CODECOV_TOKEN \
-e MAVEN_NASHORN \
jsql:latest \
./model/src/test/resources/vnc/execute-on-vnc.sh \
bash -c ' \
java -version \
&& env|sort \
&& mvn clean verify sonar:sonar \
&& (cd view/ ; mvn sonar:sonar) \
&& (cd model/ ; mvn sonar:sonar) \
&& (bash <(curl -s https://codecov.io/bash) || true) \
&& (bash <(curl -Ls https://coverage.codacy.com/get.sh) || true) \
'
DOCKER_RUN="$?"
echo docker run exit code: $DOCKER_RUN
if [ "${DOCKER_RUN}" != "0" ]; then exit 1; fi
- name: Verify database Docker containers statistics
run: |
./model/src/test/resources/docker/script/verify.sh