Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Actions and Travis enhancements #91

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
a5c856d
test parallel execution
carlosthe19916 Feb 27, 2020
68df7d7
remove custom docker install
carlosthe19916 Feb 27, 2020
afea7a4
exclude tests
carlosthe19916 Feb 27, 2020
6546200
remove code from second end2end test
carlosthe19916 Feb 27, 2020
91b24a6
ADD MAVEN PARAMS
carlosthe19916 Feb 27, 2020
417e27f
Merge branch 'master' into parallelTravis
carlosthe19916 Mar 2, 2020
fd077bd
change env for jobs
carlosthe19916 Mar 2, 2020
2744675
fix compilation error
carlosthe19916 Mar 2, 2020
8551324
add global env var
carlosthe19916 Mar 2, 2020
5a7e00c
use envs and test logs limits
carlosthe19916 Mar 2, 2020
b4eb855
first draft
carlosthe19916 Mar 3, 2020
d94a507
add settings.xml
carlosthe19916 Mar 3, 2020
cd76da1
add settings.xml
carlosthe19916 Mar 3, 2020
947c79f
omit fuse profile
carlosthe19916 Mar 3, 2020
60cdbc6
Merge branch 'master' into parallelTravis
carlosthe19916 Mar 4, 2020
1208c96
Merge branch 'githubActions' into parallelTravis
carlosthe19916 Mar 4, 2020
79cabd1
add github actions
carlosthe19916 Mar 4, 2020
d3ddf17
Merge branch 'master' into parallelTravis
carlosthe19916 Mar 9, 2020
2789e84
simplify actions
carlosthe19916 Mar 9, 2020
c0fa866
remove needs
carlosthe19916 Mar 9, 2020
b00f810
ignore tests
carlosthe19916 Mar 9, 2020
a676af5
change projectKey
carlosthe19916 Mar 9, 2020
13fea17
remove end2end test just for now
carlosthe19916 Mar 9, 2020
d57b048
remove min coverate ratio
carlosthe19916 Mar 9, 2020
f34a9e8
add codecov
carlosthe19916 Mar 9, 2020
1a79459
add codecov metrics
carlosthe19916 Mar 9, 2020
12e9051
add codecov metrics
carlosthe19916 Mar 9, 2020
5680bef
add codecov metrics
carlosthe19916 Mar 9, 2020
bb1436f
move codecov
carlosthe19916 Mar 9, 2020
f058a73
restore tests
carlosthe19916 Mar 9, 2020
638fdae
remove pull request types
carlosthe19916 Mar 9, 2020
366ebed
remove no needed changes
carlosthe19916 Mar 9, 2020
11dd7b1
add maven conditionals
carlosthe19916 Mar 9, 2020
7584bb4
split coverage profile
carlosthe19916 Mar 9, 2020
d6ae38c
split coverage profile
carlosthe19916 Mar 9, 2020
bb0d088
add github token for coverage
carlosthe19916 Mar 9, 2020
60b6307
remove env
carlosthe19916 Mar 9, 2020
7a92b3f
add maven cache
carlosthe19916 Mar 10, 2020
c4202a8
add maven cache
carlosthe19916 Mar 10, 2020
01eb5c5
remove cached since time has been increased in 3 minutes
carlosthe19916 Mar 10, 2020
ba63416
fix github actions on PR and parallel travis
carlosthe19916 Mar 10, 2020
1987abc
fix github actions typos
carlosthe19916 Mar 10, 2020
95378c5
fix travis
carlosthe19916 Mar 10, 2020
3dc43ef
fix travis env variables
carlosthe19916 Mar 10, 2020
527d27c
Merge branch 'master' into githubActions
carlosthe19916 Mar 10, 2020
017affe
Merge branch 'parallelTravis' into githubActions
carlosthe19916 Mar 10, 2020
b358f48
restore travis config
carlosthe19916 Mar 10, 2020
ca76c27
add scheduler
carlosthe19916 Mar 10, 2020
b38d446
not break travis with new changes
carlosthe19916 Mar 10, 2020
789de4e
remove upload files
carlosthe19916 Mar 10, 2020
c98aa30
add real sonar org and key
carlosthe19916 Mar 11, 2020
375531a
Merge branch 'master' into githubActions
carlosthe19916 Mar 13, 2020
c045bdb
rename end2end test
carlosthe19916 Mar 13, 2020
7aae60f
fire build
carlosthe19916 Mar 13, 2020
508e148
remove install since it is execute twice in every stage
carlosthe19916 Mar 13, 2020
bda8caa
restore install since it caused LOG error in travis
carlosthe19916 Mar 13, 2020
0ec975e
Merge branch 'master' into githubActions
carlosthe19916 Mar 16, 2020
775c08e
Merge branch 'master' into githubActions
carlosthe19916 Mar 26, 2020
47c75a9
Merge branch 'master' into githubActions
carlosthe19916 Mar 30, 2020
7aed395
add docs for Github Actions
carlosthe19916 Mar 30, 2020
ac6feac
remove the double stage in Travis
carlosthe19916 Mar 30, 2020
44697b3
remove coverage from GH Actions
carlosthe19916 Mar 30, 2020
87ae913
Remove Sonar Analysis and upload files when failed
carlosthe19916 Mar 31, 2020
e00b563
upload failure reports if build fails
carlosthe19916 Mar 31, 2020
b341b65
add profile for travis so it executes unit tests and end2end tests
carlosthe19916 Mar 31, 2020
ce8227b
include *Tests in new profile
carlosthe19916 Mar 31, 2020
7142d01
Merge branch 'master' into githubActions
carlosthe19916 Apr 9, 2020
ffd504a
Merge branch 'master' into githubActions
carlosthe19916 Jun 4, 2020
476fcb8
fix test
carlosthe19916 Jun 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
@@ -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'
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)


6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
82 changes: 64 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -351,26 +351,8 @@
<profiles>
<profile>
<id>coverage</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>project-xavier</sonar.organization>
<sonar.projectKey>project-xavier_xavier-integration</sonar.projectKey>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.5.0.1254</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down Expand Up @@ -415,6 +397,32 @@
</plugins>
</build>
</profile>
<profile>
<id>sonar</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>project-xavier</sonar.organization>
<sonar.projectKey>project-xavier_xavier-integration</sonar.projectKey>
<sonar.projectName>Xavier Integration</sonar.projectName>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.7.0.1746</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>fuse-fabric8-docker</id>
<activation>
Expand All @@ -438,5 +446,43 @@
</plugins>
</build>
</profile>
<profile>
<id>endToEnd</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/*EndToEndIT.java</include>
</includes>
<excludes>
<exclude>**/*Test.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>unitTests-endToEnd</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/*EndToEndIT.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -565,7 +565,7 @@ public void configure() {
ResponseEntity<WorkloadSummaryReportModel> workloadSummaryReport = new RestTemplate().exchange(getBaseURLAPIPath() + String.format("/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference<WorkloadSummaryReportModel>() {});

// 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.*")
Expand All @@ -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()
Expand Down Expand Up @@ -716,7 +716,7 @@ public void configure() {
assertThat(callSummaryReportAndCheckVMs(String.format("/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_InitialCostSavingsReport)).isEqualTo(14);

ResponseEntity<WorkloadSummaryReportModel> workloadSummaryReportJavaRuntimes = new RestTemplate().exchange(getBaseURLAPIPath() + String.format("/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference<WorkloadSummaryReportModel>() {});
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()
Expand Down Expand Up @@ -817,7 +817,7 @@ private HttpEntity<MultiValueMap<String, Object>> getRequestEntityForUploadRESTC
LinkedMultiValueMap<String, String> 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");
Expand Down