Skip to content

Commit 66dd9ef

Browse files
authored
Migrated travis jobs to github actions (#51)
* Created main.yml to migrate from travis to github actions * Fixed failing tests and removed travis configuration
1 parent 43c6ca9 commit 66dd9ef

File tree

3 files changed

+64
-41
lines changed

3 files changed

+64
-41
lines changed

.github/workflows/main.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
allTests:
20+
if: github.repository == 'eiffel-community/eiffel-commons'
21+
# The type of runner that the job will run on
22+
runs-on: ubuntu-latest
23+
24+
# Steps represent a sequence of tasks that will be executed as part of the job
25+
steps:
26+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
27+
- uses: actions/checkout@v3
28+
- uses: actions/setup-java@v3
29+
with:
30+
distribution: 'corretto'
31+
java-version: '8'
32+
33+
- name: Run All tests
34+
run: mvn test -B
35+
36+
reportCoverage:
37+
if: github.repository == 'eiffel-community/eiffel-commons' && github.event_name == 'push'
38+
# The type of runner that the job will run on
39+
runs-on: ubuntu-latest
40+
41+
# Steps represent a sequence of tasks that will be executed as part of the job
42+
steps:
43+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
44+
- uses: actions/checkout@v3
45+
- uses: actions/setup-java@v3
46+
with:
47+
distribution: 'corretto'
48+
java-version: '8'
49+
50+
- name: Run cobertura
51+
shell: bash
52+
run: |
53+
mvn cobertura:cobertura -Dcobertura.report.format=xml -B
54+
55+
# Generating test coverage report and publishing to Codacy
56+
- name: Run report coverage
57+
uses: codacy/codacy-coverage-reporter-action@v1
58+
with:
59+
project-token: e47987d1f0e94f809b08d26cfe24e90f
60+
coverage-reports: target/site/cobertura/coverage.xml

.travis.yml

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

src/test/java/com/ericsson/eiffelcommons/http/HttpRequestTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
public class HttpRequestTest {
3434
private static final String URL_1 = "http://something.com";
3535
private static final String URL_2 = "http://something.com/";
36+
private static final String URL_3 = "http://someothing.com";
3637
private static final String URL_BAD_PROTOCOL = "httpl://something.com/";
3738
private static final String URL_BAD_SYNTAX = "http:<<something.com/";
3839
private static final String ENDPOINT_1 = "/testing/test/";
@@ -229,7 +230,7 @@ public void testGetURI() throws MalformedURLException, URISyntaxException {
229230
public void testPerformRequestUnknownHost()
230231
throws ClientProtocolException, URISyntaxException, IOException {
231232
HttpRequest request = new HttpRequest(HttpMethod.GET);
232-
request.setBaseUrl(URL_1).setEndpoint(ENDPOINT_1);
233+
request.setBaseUrl(URL_3).setEndpoint(ENDPOINT_1);
233234
request.performRequest();
234235
}
235236

@@ -252,15 +253,15 @@ public void testPerformRequestBadSyntax()
252253
public void testPerformRequestNoEndpoint()
253254
throws ClientProtocolException, URISyntaxException, IOException {
254255
HttpRequest request = new HttpRequest(HttpMethod.GET);
255-
request.setBaseUrl(URL_1);
256+
request.setBaseUrl(URL_3);
256257
request.performRequest();
257258
}
258259

259260
@Test(expected = UnknownHostException.class)
260261
public void testPerformRequestWithParameters()
261262
throws ClientProtocolException, URISyntaxException, IOException {
262263
HttpRequest request = new HttpRequest(HttpMethod.GET);
263-
request.setBaseUrl(URL_1).addParameter(PARAMETER_KEY_1, PARAMETER_VALUE_1);
264+
request.setBaseUrl(URL_3).addParameter(PARAMETER_KEY_1, PARAMETER_VALUE_1);
264265
request.performRequest();
265266
}
266267
}

0 commit comments

Comments
 (0)