Skip to content

Commit b011650

Browse files
jainadc9jainad
andauthored
Created main.yml for github action to migrate from travis (#535)
* Created github action main.yml to migrate jobs from travis Co-authored-by: jainad <jainad.chinta@ericsson.com>
1 parent b31dc01 commit b011650

File tree

2 files changed

+143
-52
lines changed

2 files changed

+143
-52
lines changed

.github/workflows/main.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CI
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the master branch
8+
push:
9+
branches: [ master ]
10+
pull_request:
11+
branches: [ master ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
unitAndFunctionalTests:
20+
# The type of runner that the job will run on
21+
runs-on: ubuntu-18.04
22+
env:
23+
JAVA_HOME: /usr/lib/jvm/java-1.8.0-openjdk-amd64
24+
M2_HOME: /opt/apache-maven-3.6.3
25+
MAVEN_HOME: /opt/apache-maven-3.6.3
26+
27+
# Steps represent a sequence of tasks that will be executed as part of the job
28+
steps:
29+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
30+
- uses: actions/checkout@v3
31+
32+
# Runs a set of commands using the runners shell
33+
# Run before every job
34+
- name: Install Java
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y openjdk-8-jdk
38+
java -version
39+
uname -a
40+
chmod +x pom.xml
41+
42+
- name: Install Maven
43+
shell: bash
44+
run: |
45+
wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /tmp
46+
tar xf /tmp/apache-maven-3.6.3-bin.tar.gz -C /opt
47+
echo "${M2_HOME}/bin" >> $GITHUB_PATH
48+
49+
# To ensure docker containers are fully up and running we sleep 60s
50+
- name: Before script
51+
run: |
52+
source src/main/docker/env.bash
53+
docker-compose -f src/main/docker/docker-compose.yml up -d mongodb mongodb-auth rabbitmq eiffel-er mail-server
54+
sleep 60
55+
56+
- name: Run unit and functional tests
57+
run: |
58+
mvn --version
59+
mvn test -DskipITs -Dsurefire.rerunFailingTestsCount=2 -Djasypt.encryptor.password=secret -Dspring.config.location=src/functionaltests/resources/application.properties -B
60+
61+
integrationTests:
62+
# The type of runner that the job will run on
63+
runs-on: ubuntu-18.04
64+
env:
65+
JAVA_HOME: /usr/lib/jvm/java-1.8.0-openjdk-amd64
66+
M2_HOME: /opt/apache-maven-3.6.3
67+
MAVEN_HOME: /opt/apache-maven-3.6.3
68+
69+
# Steps represent a sequence of tasks that will be executed as part of the job
70+
steps:
71+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
72+
- uses: actions/checkout@v3
73+
74+
# Runs a set of commands using the runners shell
75+
# Run before every job
76+
- name: Install Java
77+
run: |
78+
sudo apt-get update
79+
sudo apt-get install -y openjdk-8-jdk
80+
java -version
81+
uname -a
82+
chmod +x pom.xml
83+
mvn --version
84+
85+
- name: Install Maven
86+
shell: bash
87+
run: |
88+
wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /tmp
89+
tar xf /tmp/apache-maven-3.6.3-bin.tar.gz -C /opt
90+
ln -s /opt/apache-maven-3.6.3 /opt/maven
91+
echo "${M2_HOME}/bin" >> $GITHUB_PATH
92+
93+
# To ensure docker containers are fully up and running we sleep 60s
94+
- name: Before script
95+
run: |
96+
source src/main/docker/env.bash
97+
docker-compose -f src/main/docker/docker-compose.yml up -d mongodb mongodb-auth rabbitmq eiffel-er jenkins mail-server
98+
sleep 60
99+
100+
- name: Run integration tests
101+
run: |
102+
mvn --version
103+
mvn verify -DskipUTs -Djasypt.encryptor.password=integrationtest -Dspring.config.location=src/integrationtests/resources/application.properties -B
104+
105+
reportCoverage:
106+
# The type of runner that the job will run on
107+
runs-on: ubuntu-18.04
108+
env:
109+
JAVA_HOME: /usr/lib/jvm/java-1.8.0-openjdk-amd64
110+
M2_HOME: /opt/apache-maven-3.6.3
111+
MAVEN_HOME: /opt/apache-maven-3.6.3
112+
113+
# Steps represent a sequence of tasks that will be executed as part of the job
114+
steps:
115+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
116+
- uses: actions/checkout@v3
117+
118+
# Runs a set of commands using the runners shell
119+
# Run before every job
120+
- name: Install Java
121+
run: |
122+
sudo apt-get update
123+
sudo apt-get install -y openjdk-8-jdk
124+
java -version
125+
uname -a
126+
chmod +x pom.xml
127+
mvn --version
128+
129+
- name: Install Maven
130+
shell: bash
131+
run: |
132+
wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /tmp
133+
tar xf /tmp/apache-maven-3.6.3-bin.tar.gz -C /opt
134+
echo "${M2_HOME}/bin" >> $GITHUB_PATH
135+
136+
# Generating test coverage report and publishing to Codacy
137+
- name: Run report coverage
138+
shell: bash
139+
run: |
140+
mvn --version
141+
mvn cobertura:cobertura -Dcobertura.report.format=xml -B
142+
curl -LSs $(curl -LSs https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({content_type, browser_download_url} | select(.content_type | contains("application/octet-stream"))) | .[0].browser_download_url') -o codacy-coverage-reporter-assembly.jar
143+
java -jar codacy-coverage-reporter-assembly.jar report -l Java -r target/site/cobertura/coverage.xml

.travis.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)