diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml
new file mode 100644
index 00000000..7fbdd510
--- /dev/null
+++ b/.github/workflows/ci-actions.yml
@@ -0,0 +1,103 @@
+name: Xavier Integration CI
+
+on:
+ # Will execute the jobs when a push even (new commit) appears in the repository. This includes all branches including 'master' branch.
+ push:
+ branches-ignore:
+ - 'dependabot/**'
+ paths-ignore:
+ - 'README.md'
+ - '.dependabot/**'
+ # Will execute the jobs when a new Pull Request is registered in the repository
+ pull_request:
+ types: [assigned, opened, synchronize, reopened, ready_for_review, edited]
+ paths-ignore:
+ - 'README.md'
+ # Will execute the jobs daily at 00:00:00
+ schedule:
+ - cron: '0 0 * * *'
+
+# Declare ENV variables that will be available in every Job
+env:
+ JVM_TEST_MAVEN_OPTS: "-e -B -P !fuse-fabric8-docker --settings configuration/settings.xml"
+
+# Jobs are executed in parallel unless we use 'needs' field to describe dependencies between jobs
+jobs:
+
+ # Execute all unit tests
+ linux-jvm-tests:
+ name: JDK 8 JVM Tests
+ timeout-minutes: 120
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Clone Repo
+ uses: actions/checkout@v2
+ - name: Set up JDK 8
+ # Uses sha for added security since tags can be updated
+ uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9
+ with:
+ java-version: openjdk8
+ - name: Build with Maven
+ # If 'pull_request' just execute tests
+# if: github.event_name == 'pull_request'
+ run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage
+ - name: Prepare failure archive (if maven failed)
+ if: failure()
+ shell: bash
+ run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T -
+ - name: Upload failure Archive (if maven failed)
+ uses: actions/upload-artifact@v1
+ if: failure()
+ with:
+ name: test-reports
+ path: 'test-reports.tgz'
+##
+## THE SONAR ANALYSIS WILL BE DONE IN TRAVIS
+##
+# - name: Build with Maven and Sonar
+# # If not 'pull_request' execute tests and analyze the code using Sonar maven profile
+# if: github.event_name != 'pull_request'
+# run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar
+# env:
+# # No need to add GITHUB_TOKEN to the list of secrets in Github since it is available by default.
+# # But we do need to add SONAR_TOKEN in the Github Secrets Page.
+# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+##
+## THE COVERAGE REPORT SHOULD BE GENERATED IN TRAVIS
+##
+# - name: Codecov metrics
+# uses: codecov/codecov-action@v1
+
+ # Execute all end-to-end tests. We need to add the names of the end-to-end classes to 'strategy.matrix.class-name' field
+ # so all our end-to-end tests run in parallel.
+ linux-jdk8-jvm-end2end-tests:
+ name: JDK 8 JVM ${{matrix.class-name}} Test
+ timeout-minutes: 120
+ strategy:
+ fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }}
+ matrix:
+ class-name: [UploadPayloadEndToEndIT] # List of end-to-end classes
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up JDK 1.8
+ # Uses sha for added security since tags can be updated
+ uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9
+ with:
+ java-version: openjdk8
+ - name: Build with Maven
+ run: eval mvn $JVM_TEST_MAVEN_OPTS -P coverage,endToEnd -Dtest=${{ matrix.class-name }} test
+ - name: Prepare failure archive (if maven failed)
+ if: failure()
+ shell: bash
+ run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T -
+ - name: Upload failure Archive (if maven failed)
+ uses: actions/upload-artifact@v1
+ if: failure()
+ with:
+ name: test-reports-${{matrix.class-name}}
+ path: 'test-reports.tgz'
diff --git a/.travis.yml b/.travis.yml
index 54a974e2..d682340e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,7 +21,7 @@ addons:
sudo: required
services:
- - docker
+ - docker
# Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3
before_install:
@@ -49,8 +49,6 @@ jobs:
- LOGGING_LEVEL_ROOT=info
- ANALYSIS_DATAINTEGRITY_LOG=false
script:
- - mvn test -Pcoverage -Danalysis.dataintegrity.log=false
+ - mvn test -P coverage,unitTests-endToEnd -Danalysis.dataintegrity.log=false
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi'
- bash <(curl -s https://codecov.io/bash)
-
-
diff --git a/README.md b/README.md
index 784af68a..3fcb4745 100644
--- a/README.md
+++ b/README.md
@@ -115,4 +115,8 @@ If using the Fedora docker package it is needed to set the *ryuk.container.privi
# References
-
+# Github Actions
+Github Actions is used to manage the software development workflow of this project. Every single Workflow should be placed in
+the folder `.github/workflows/` using the `.yml` extension; e.g. `my-action.yml`. Currently we have:
+- `.github/workflows/ci-actions.yml` used for executing unit tests and end-to-end tests on Pull Requests, new Commits in the `master` branch, and it also executes
+tests daily using the `schedule:cron` feature. See the comments inside the file for more details.
diff --git a/pom.xml b/pom.xml
index 34cc2dd7..607f5783 100644
--- a/pom.xml
+++ b/pom.xml
@@ -351,26 +351,8 @@
coverage
-
- https://sonarcloud.io
- project-xavier
- project-xavier_xavier-integration
-
-
- org.sonarsource.scanner.maven
- sonar-maven-plugin
- 3.5.0.1254
-
-
- verify
-
- sonar
-
-
-
-
org.jacoco
jacoco-maven-plugin
@@ -415,6 +397,32 @@
+
+ sonar
+
+ https://sonarcloud.io
+ project-xavier
+ project-xavier_xavier-integration
+ Xavier Integration
+
+
+
+
+ org.sonarsource.scanner.maven
+ sonar-maven-plugin
+ 3.7.0.1746
+
+
+ verify
+
+ sonar
+
+
+
+
+
+
+
fuse-fabric8-docker
@@ -438,5 +446,43 @@
+
+ endToEnd
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+
+ **/*EndToEndIT.java
+
+
+ **/*Test.java
+
+
+
+
+
+
+
+ unitTests-endToEnd
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+
+ **/*Test.java
+ **/*EndToEndIT.java
+
+
+
+
+
+
diff --git a/src/test/java/org/jboss/xavier/integrations/EndToEndTest.java b/src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java
similarity index 98%
rename from src/test/java/org/jboss/xavier/integrations/EndToEndTest.java
rename to src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java
index b8245917..58377d0d 100644
--- a/src/test/java/org/jboss/xavier/integrations/EndToEndTest.java
+++ b/src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java
@@ -100,11 +100,11 @@
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
@UseAdviceWith // Disables automatic start of Camel context
@SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-@ContextConfiguration(initializers = EndToEndTest.Initializer.class)
+@ContextConfiguration(initializers = UploadPayloadEndToEndIT.Initializer.class)
@Import(TestConfigurationS3.class)
@ActiveProfiles("test")
-public class EndToEndTest {
- private static Logger logger = LoggerFactory.getLogger(EndToEndTest.class);
+public class UploadPayloadEndToEndIT {
+ private static Logger logger = LoggerFactory.getLogger(UploadPayloadEndToEndIT.class);
@ClassRule
public static GenericContainer activemq = new GenericContainer<>("vromero/activemq-artemis")
@@ -565,7 +565,7 @@ public void configure() {
ResponseEntity workloadSummaryReport = new RestTemplate().exchange(getBaseURLAPIPath() + String.format("/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {});
// Checks on Initial Savings Report
- InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), InitialSavingsEstimationReportModel.class);
+ InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), InitialSavingsEstimationReportModel.class);
SoftAssertions.assertSoftly(softly -> softly.assertThat(initialCostSavingsReport.getBody())
.usingRecursiveComparison()
.ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*", ".*report.*")
@@ -590,14 +590,14 @@ public void configure() {
softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getOsName().contains("ServerNT") && e.getWorkloads().contains("Microsoft SQL Server")).count()).isEqualTo(1);
});
- WorkloadInventoryReportModel[] workloadInventoryReportModelExpected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-inventory-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), WorkloadInventoryReportModel[].class);
+ WorkloadInventoryReportModel[] workloadInventoryReportModelExpected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-inventory-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), WorkloadInventoryReportModel[].class);
assertThat(workloadInventoryReport.getBody().getContent().toArray())
.usingRecursiveComparison()
.ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*")
.isEqualTo(workloadInventoryReportModelExpected);
// Checks on Workload Summary Report
- WorkloadSummaryReportModel workloadSummaryReport_Expected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), WorkloadSummaryReportModel.class);
+ WorkloadSummaryReportModel workloadSummaryReport_Expected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), WorkloadSummaryReportModel.class);
assertThat(workloadSummaryReport.getBody())
.usingRecursiveComparison()
@@ -716,7 +716,7 @@ public void configure() {
assertThat(callSummaryReportAndCheckVMs(String.format("/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_InitialCostSavingsReport)).isEqualTo(14);
ResponseEntity workloadSummaryReportJavaRuntimes = new RestTemplate().exchange(getBaseURLAPIPath() + String.format("/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {});
- WorkloadSummaryReportModel workloadSummaryReport_JavaRuntimesExpected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20200304-Linux_JDK-summary-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), WorkloadSummaryReportModel.class);
+ WorkloadSummaryReportModel workloadSummaryReport_JavaRuntimesExpected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20200304-Linux_JDK-summary-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), WorkloadSummaryReportModel.class);
assertThat(workloadSummaryReportJavaRuntimes.getBody())
.usingRecursiveComparison()
@@ -817,7 +817,7 @@ private HttpEntity> getRequestEntityForUploadRESTC
LinkedMultiValueMap fileMap = new LinkedMultiValueMap<>();
fileMap.add(HttpHeaders.CONTENT_DISPOSITION, "form-data; name=filex; filename=" + filename);
fileMap.add("Content-type", content_type_header);
- body.add("file", new HttpEntity<>(IOUtils.resourceToByteArray(filename, EndToEndTest.class.getClassLoader()), fileMap));
+ body.add("file", new HttpEntity<>(IOUtils.resourceToByteArray(filename, UploadPayloadEndToEndIT.class.getClassLoader()), fileMap));
// params Body parts
body.add("percentageOfHypervisorsMigratedOnYear1", "50");